Skip to content

Commit ed47f86

Browse files
committed
copilog
1 parent e3d9837 commit ed47f86

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

services/web/server/src/simcore_service_webserver/garbage_collector/_core_disconnected.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
async def remove_disconnected_user_resources(
1818
registry: RedisResourceRegistry, app: web.Application
1919
) -> None:
20-
2120
# NOTE:
2221
# Each user session is represented in the redis registry with two keys:
2322
# - "alive" is a string that keeps a TTL of the user session
@@ -31,7 +30,7 @@ async def remove_disconnected_user_resources(
3130

3231
# clean up all resources of expired keys
3332
for dead_session in dead_user_sessions:
34-
user_id = int(dead_session["user_id"])
33+
user_id = dead_session["user_id"]
3534

3635
# (0) If key has no resources => remove from registry and continue
3736
resources = await registry.get_resources(dead_session)
@@ -53,10 +52,13 @@ async def remove_disconnected_user_resources(
5352
# inform that the project can be closed on the backend side
5453
#
5554
project_id = TypeAdapter(ProjectID).validate_python(resource_value)
56-
with log_catch(_logger, reraise=False), log_context(
57-
_logger,
58-
logging.INFO,
59-
"Closing project {project_id} for user {user_id=}",
55+
with (
56+
log_catch(_logger, reraise=False),
57+
log_context(
58+
_logger,
59+
logging.INFO,
60+
"Closing project {project_id} for user {user_id=}",
61+
),
6062
):
6163
await _projects_service.close_project_for_user(
6264
user_id=user_id,

services/web/server/src/simcore_service_webserver/resource_manager/registry.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,10 @@
3939
_RESOURCE_SUFFIX = "resources" # points to a hash (like a dict) type
4040

4141

42-
class _UserRequired(TypedDict, total=True):
43-
user_id: str | UserID
44-
45-
46-
class UserSessionDict(_UserRequired):
42+
class UserSessionDict(TypedDict):
4743
"""Parts of the key used in redis for a user-session"""
4844

45+
user_id: UserID
4946
client_session_id: str
5047

5148

0 commit comments

Comments
 (0)