File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
services/web/server/src/simcore_service_webserver/garbage_collector Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 44"""
55
66import logging
7- from collections .abc import AsyncIterator , Callable
7+ from collections .abc import AsyncIterator
88from datetime import timedelta
99
1010from aiohttp import web
2020
2121_logger = logging .getLogger (__name__ )
2222
23- CleanupContextFunc = Callable [[web .Application ], AsyncIterator [None ]]
24-
2523
2624async def notify_user_logout_all_sessions (
2725 app : web .Application , user_id : UserID
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ async def setup_periodic_task(
2323 periodic_task_coro: The periodic task coroutine function (already decorated with @exclusive_periodic)
2424 """
2525 # setup
26- task_name = periodic_task_coro .__name__
26+ task_name = f" { periodic_task_coro .__module__ } . { periodic_task_coro . __name__ } "
2727
2828 task = asyncio .create_task (
2929 periodic_task_coro (),
@@ -32,6 +32,10 @@ async def setup_periodic_task(
3232
3333 # prevents premature garbage collection of the task
3434 app_task_key = f"tasks.{ task_name } "
35+ if app_task_key in app :
36+ msg = f"Task { task_name } is already registered in the app state"
37+ raise ValueError (msg )
38+
3539 app [app_task_key ] = task
3640
3741 yield
You can’t perform that action at this time.
0 commit comments