Skip to content

Commit 97120df

Browse files
committed
UNIT_REGISTRY_APPKEY
1 parent 2d6fef3 commit 97120df

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

services/web/server/src/simcore_service_webserver/catalog/_controller_rest_schemas.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from servicelib.aiohttp.requests_validation import handle_validation_as_http_error
2828

2929
from ..constants import RQ_PRODUCT_KEY, RQT_USERID_KEY
30+
from ._web_states import UNIT_REGISTRY_APPKEY
3031

3132
_logger = logging.getLogger(__name__)
3233

@@ -166,7 +167,7 @@ def create(cls, request: Request) -> "CatalogRequestContext":
166167
app=request.app,
167168
user_id=request[RQT_USERID_KEY],
168169
product_name=request[RQ_PRODUCT_KEY],
169-
unit_registry=request.app[UnitRegistry.__name__],
170+
unit_registry=request.app[UNIT_REGISTRY_APPKEY],
170171
)
171172

172173

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from typing import Final
2+
3+
from aiohttp import web
4+
from pint import UnitRegistry
5+
6+
UNIT_REGISTRY_APPKEY: Final = web.AppKey("UNIT_REGISTRY_APPKEY", UnitRegistry)

services/web/server/src/simcore_service_webserver/catalog/plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from ..application_setup import ModuleCategory, app_setup_func
1010
from . import _controller_rest
11+
from ._web_states import UNIT_REGISTRY_APPKEY
1112

1213
_logger = logging.getLogger(__name__)
1314

@@ -31,4 +32,4 @@ def setup_catalog(app: web.Application):
3132
app.add_routes(_controller_rest.routes)
3233

3334
# prepares units registry
34-
app[UnitRegistry.__name__] = UnitRegistry()
35+
app[UNIT_REGISTRY_APPKEY] = UnitRegistry()

services/web/server/src/simcore_service_webserver/diagnostics/_healthcheck.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def value(self) -> float:
5555
HEALTH_LAST_REQUESTS_AVG_LATENCY: Final = f"{__name__}.last_requests_avg_latency"
5656
HEALTH_MAX_AVG_RESP_LATENCY: Final = f"{__name__}.max_avg_response_latency"
5757
HEALTH_MAX_TASK_DELAY: Final = f"{__name__}.max_task_delay"
58-
HEALTH_PLUGIN_START_TIME: Final = web.AppKey("HEALTH_PLUGIN_START_TIME", time.time)
58+
HEALTH_PLUGIN_START_TIME: Final = web.AppKey("HEALTH_PLUGIN_START_TIME", float)
5959
HEALTH_START_SENSING_DELAY_SECS: Final = f"{__name__}.start_sensing_delay"
6060

6161

0 commit comments

Comments
 (0)