add noqa for some db methods

This commit is contained in:
Kenneth Kehl
2023-08-08 11:57:57 -07:00
parent abd1898150
commit 8d74a46d7c

View File

@@ -357,17 +357,17 @@ def setup_sqlalchemy_events(app):
# need this or db.engine isn't accessible # need this or db.engine isn't accessible
with app.app_context(): with app.app_context():
@event.listens_for(db.engine, 'connect') @event.listens_for(db.engine, 'connect')
def connect(): def connect(dbapi_connection, connection_record): # noqa
# connection first opened with db # connection first opened with db
TOTAL_DB_CONNECTIONS.inc() TOTAL_DB_CONNECTIONS.inc()
@event.listens_for(db.engine, 'close') @event.listens_for(db.engine, 'close')
def close(): def close(dbapi_connection, connection_record): # noqa
# connection closed (probably only happens with overflow connections) # connection closed (probably only happens with overflow connections)
TOTAL_DB_CONNECTIONS.dec() TOTAL_DB_CONNECTIONS.dec()
@event.listens_for(db.engine, 'checkout') @event.listens_for(db.engine, 'checkout')
def checkout(connection_record): def checkout(dbapi_connection, connection_record, connection_proxy): # noqa
try: try:
# connection given to a web worker # connection given to a web worker
TOTAL_CHECKED_OUT_DB_CONNECTIONS.inc() TOTAL_CHECKED_OUT_DB_CONNECTIONS.inc()
@@ -405,7 +405,7 @@ def setup_sqlalchemy_events(app):
current_app.logger.exception("Exception caught for checkout event.") current_app.logger.exception("Exception caught for checkout event.")
@event.listens_for(db.engine, 'checkin') @event.listens_for(db.engine, 'checkin')
def checkin(connection_record): def checkin(dbapi_connection, connection_record): # noqa
try: try:
# connection returned by a web worker # connection returned by a web worker
TOTAL_CHECKED_OUT_DB_CONNECTIONS.dec() TOTAL_CHECKED_OUT_DB_CONNECTIONS.dec()