mirror of
https://github.com/sprockets/sprockets-postgres.git
synced 2024-11-13 03:00:19 +00:00
Delay the initialization of asyncio objects to on_start
This commit is contained in:
parent
70cf5c005b
commit
4f60c7bf0a
2 changed files with 6 additions and 3 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.3.1
|
||||
1.3.2
|
||||
|
|
|
@ -290,8 +290,8 @@ class ApplicationMixin:
|
|||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self._postgres_pool: typing.Optional[pool.Pool] = None
|
||||
self._postgres_connected = asyncio.Event()
|
||||
self._postgres_reconnect = asyncio.Lock()
|
||||
self._postgres_connected: typing.Optional[asyncio.Event] = None
|
||||
self._postgres_reconnect: typing.Optional[asyncio.Lock] = None
|
||||
self._postgres_srv: bool = False
|
||||
self.runner_callbacks['on_start'].append(self._postgres_on_start)
|
||||
self.runner_callbacks['shutdown'].append(self._postgres_shutdown)
|
||||
|
@ -480,6 +480,9 @@ class ApplicationMixin:
|
|||
callback mechanism.
|
||||
|
||||
"""
|
||||
self._postgres_connected = asyncio.Event()
|
||||
self._postgres_reconnect = asyncio.Lock()
|
||||
|
||||
if 'POSTGRES_URL' not in os.environ:
|
||||
LOGGER.critical('Missing POSTGRES_URL environment variable')
|
||||
return self.stop(loop)
|
||||
|
|
Loading…
Reference in a new issue