-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: deprecated connection timeout in pg ext
- Loading branch information
Showing
1 changed file
with
10 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,10 +13,12 @@ | |
Copyright (c) 2014, Alexey Kinëv <[email protected]> | ||
""" | ||
import warnings | ||
|
||
from playhouse import postgres_ext as ext | ||
from playhouse.db_url import register_database | ||
|
||
from peewee_async import AsyncPostgresqlMixin, aiopg | ||
from peewee_async import AsyncPostgresqlMixin | ||
|
||
|
||
class PostgresqlExtDatabase(AsyncPostgresqlMixin, ext.PostgresqlExtDatabase): | ||
|
@@ -71,7 +73,13 @@ class PooledPostgresqlExtDatabase( | |
def init(self, database, **kwargs): | ||
self.min_connections = kwargs.pop('min_connections', 1) | ||
self.max_connections = kwargs.pop('max_connections', 20) | ||
self._timeout = kwargs.pop('connection_timeout', aiopg.DEFAULT_TIMEOUT) | ||
connection_timeout = kwargs.pop('connection_timeout', None) | ||
if connection_timeout is not None: | ||
warnings.warn( | ||
"`connection_timeout` is deprecated, use `connect_timeout` instead.", | ||
DeprecationWarning | ||
) | ||
kwargs['connect_timeout'] = connection_timeout | ||
super().init(database, **kwargs) | ||
self.init_async( | ||
enable_json=True, | ||
|