File tree Expand file tree Collapse file tree 4 files changed +12
-9
lines changed
packages/service-library/src/servicelib/aiohttp
services/web/server/src/simcore_service_webserver Expand file tree Collapse file tree 4 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 1111
1212from typing import Final
1313
14- from aiohttp import web
14+ from aiohttp import ClientSession , web
1515
1616# APPLICATION's CONTEXT KEYS
1717
2525
2626APP_AIOPG_ENGINE_KEY : Final [str ] = f"{ __name__ } .aiopg_engine"
2727
28- APP_CLIENT_SESSION_KEY : Final [str ] = f"{ __name__ } .session"
28+ APP_CLIENT_SESSION_KEY : web .AppKey [ClientSession ] = web .AppKey ("APP_CLIENT_SESSION_KEY" )
29+
2930
3031APP_FIRE_AND_FORGET_TASKS_KEY : Final [str ] = f"{ __name__ } .tasks"
3132
Original file line number Diff line number Diff line change 88 get_http_client_request_aiohttp_sock_connect_timeout ,
99 get_http_client_request_total_timeout ,
1010)
11-
12- APP_CLIENT_SESSION_KEY : web .AppKey [ClientSession ] = web .AppKey ("APP_CLIENT_SESSION_KEY" )
11+ from .application_keys import APP_CLIENT_SESSION_KEY
1312
1413
1514async def persistent_client_session (app : web .Application ) -> AsyncGenerator [None , None ]:
@@ -45,6 +44,7 @@ def get_client_session(app: web.Application) -> ClientSession:
4544
4645
4746__all__ : tuple [str , ...] = (
47+ "APP_CLIENT_SESSION_KEY" ,
4848 "get_client_session" ,
4949 "persistent_client_session" ,
5050)
Original file line number Diff line number Diff line change 66from common_library .user_messages import user_message
77from servicelib .aiohttp .application_keys import (
88 APP_AIOPG_ENGINE_KEY ,
9+ APP_CLIENT_SESSION_KEY ,
910 APP_CONFIG_KEY ,
1011 APP_FIRE_AND_FORGET_TASKS_KEY ,
1112)
2425 APP_SETTINGS_KEY : web .AppKey = web .AppKey ("APP_SETTINGS_KEY" , None )
2526
2627
28+ assert APP_CLIENT_SESSION_KEY # nosec
29+ assert APP_CONFIG_KEY # nosec
30+
2731# Application storage keys
2832APP_PRODUCTS_KEY : Final [str ] = f"{ __name__ } .APP_PRODUCTS_KEY"
2933
6771
6872__all__ : tuple [str , ...] = (
6973 "APP_AIOPG_ENGINE_KEY" ,
70- "APP_CONFIG_KEY" ,
74+ "APP_CLIENT_SESSION_KEY" " APP_CONFIG_KEY" ,
7175 "APP_FIRE_AND_FORGET_TASKS_KEY" ,
7276 "APP_SETTINGS_KEY" ,
7377 "FRONTEND_APPS_AVAILABLE" ,
Original file line number Diff line number Diff line change 11"""director v2 susystem configuration"""
22
33from functools import cached_property
4- from typing import cast
54
65from aiohttp import ClientSession , ClientTimeout , web
76from models_library .basic_types import VersionTag
87from pydantic import AliasChoices , Field , PositiveInt
9- from servicelib .aiohttp .application_keys import APP_CLIENT_SESSION_KEY
108from settings_library .base import BaseCustomSettings
119from settings_library .basic_types import PortInt
1210from settings_library .utils_service import DEFAULT_FASTAPI_PORT , MixinServiceSettings
1311from yarl import URL
1412
15- from ..constants import APP_SETTINGS_KEY
13+ from ..constants import APP_CLIENT_SESSION_KEY , APP_SETTINGS_KEY
1614
1715_MINUTE = 60
1816_HOUR = 60 * _MINUTE
@@ -61,4 +59,4 @@ def get_plugin_settings(app: web.Application) -> DirectorV2Settings:
6159
6260
6361def get_client_session (app : web .Application ) -> ClientSession :
64- return cast ( ClientSession , app [APP_CLIENT_SESSION_KEY ])
62+ return app [APP_CLIENT_SESSION_KEY ]
You can’t perform that action at this time.
0 commit comments