mirror of
https://github.com/sprockets/sprockets-postgres.git
synced 2024-12-27 11:17:30 +00:00
Dont create objects if we do not need to
This commit is contained in:
parent
4f60c7bf0a
commit
440def6f3c
1 changed files with 4 additions and 3 deletions
|
@ -480,12 +480,13 @@ 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)
|
||||
|
||||
self._postgres_connected = asyncio.Event()
|
||||
self._postgres_reconnect = asyncio.Lock()
|
||||
|
||||
if not await self._postgres_connect():
|
||||
LOGGER.critical('PostgreSQL failed to connect, shutting down')
|
||||
return self.stop(loop)
|
||||
|
|
Loading…
Reference in a new issue