Skip to content

Commit

Permalink
fix: deprecated connection timeout in pg ext
Browse files Browse the repository at this point in the history
  • Loading branch information
kalombos committed May 2, 2024
1 parent b54abbf commit 27b9be3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions peewee_asyncext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 27b9be3

Please sign in to comment.