File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
packages/service-library/src/servicelib/aiohttp Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 1717from ..db_asyncpg_utils import create_async_engine_and_database_ready
1818from ..logging_utils import log_context
1919
20- APP_DB_ASYNC_ENGINE_KEY : Final [str ] = f"{ __name__ } .AsyncEngine"
21-
20+ DB_ASYNC_ENGINE_APPKEY : Final = web .AppKey ("DB_ASYNC_ENGINE" , AsyncEngine )
2221
2322_logger = logging .getLogger (__name__ )
2423
2524
2625def _set_async_engine_to_app_state (app : web .Application , engine : AsyncEngine ):
27- if exists := app .get (APP_DB_ASYNC_ENGINE_KEY , None ):
28- msg = f"An instance of { type (exists )} already in app[{ APP_DB_ASYNC_ENGINE_KEY } ]={ exists } "
26+ if exists := app .get (DB_ASYNC_ENGINE_APPKEY , None ):
27+ msg = f"An instance of { type (exists )} already in app[{ DB_ASYNC_ENGINE_APPKEY } ]={ exists } "
2928 raise ValueError (msg )
3029
31- app [APP_DB_ASYNC_ENGINE_KEY ] = engine
30+ app [DB_ASYNC_ENGINE_APPKEY ] = engine
3231 return get_async_engine (app )
3332
3433
3534def get_async_engine (app : web .Application ) -> AsyncEngine :
36- engine : AsyncEngine = app [APP_DB_ASYNC_ENGINE_KEY ]
35+ engine : AsyncEngine = app [DB_ASYNC_ENGINE_APPKEY ]
3736 assert engine # nosec
3837 return engine
3938
You can’t perform that action at this time.
0 commit comments