Merge pull request #2828 from jakedt/attribs
Use a more pro-active approach to identify an uninitialized db proxy.
This commit is contained in:
commit
90ed0c28be
1 changed files with 6 additions and 11 deletions
|
@ -323,18 +323,13 @@ get_epoch_timestamp_ms = lambda: int(time.time() * 1000)
|
|||
|
||||
|
||||
def close_db_filter(_):
|
||||
try:
|
||||
if not db.is_closed():
|
||||
logger.debug('Disconnecting from database.')
|
||||
db.close()
|
||||
if db.obj is not None and not db.is_closed():
|
||||
logger.debug('Disconnecting from database.')
|
||||
db.close()
|
||||
|
||||
if read_slave.obj is not None and not read_slave.is_closed():
|
||||
logger.debug('Disconnecting from read slave.')
|
||||
read_slave.close()
|
||||
except AttributeError:
|
||||
# If the database is closed between the time we check on line 309 and db.close() is called on
|
||||
# 311, then an AttributeError will be raised. Simply eat this exception and continue onward.
|
||||
pass
|
||||
if read_slave.obj is not None and not read_slave.is_closed():
|
||||
logger.debug('Disconnecting from read slave.')
|
||||
read_slave.close()
|
||||
|
||||
|
||||
class QuayUserField(ForeignKeyField):
|
||||
|
|
Reference in a new issue