File tree Expand file tree Collapse file tree 4 files changed +12
-8
lines changed
services/web/server/src/simcore_service_webserver/garbage_collector Expand file tree Collapse file tree 4 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -33,12 +33,13 @@ def create_background_task_to_prune_api_keys(
3333) -> CleanupContextFunc :
3434
3535 async def _cleanup_ctx_fun (app : web .Application ) -> AsyncIterator [None ]:
36+ interval = timedelta (seconds = wait_period_s )
3637
3738 @exclusive_periodic (
3839 # Function-exclusiveness is required to avoid multiple tasks like thisone running concurrently
3940 get_redis_lock_manager_client_sdk (app ),
40- task_interval = timedelta ( seconds = wait_period_s ) ,
41- retry_after = timedelta ( minutes = 5 ) ,
41+ task_interval = interval ,
42+ retry_after = interval ,
4243 )
4344 async def _prune_expired_api_keys_periodically () -> None :
4445 with log_context (_logger , logging .INFO , "Pruning expired API keys" ):
Original file line number Diff line number Diff line change @@ -24,12 +24,13 @@ def create_background_task_for_garbage_collection() -> CleanupContextFunc:
2424
2525 async def _cleanup_ctx_fun (app : web .Application ) -> AsyncIterator [None ]:
2626 settings : GarbageCollectorSettings = get_plugin_settings (app )
27+ interval = timedelta (seconds = settings .GARBAGE_COLLECTOR_INTERVAL_S )
2728
2829 @exclusive_periodic (
2930 # Function-exclusiveness is required to avoid multiple tasks like thisone running concurrently
3031 get_redis_lock_manager_client_sdk (app ),
31- task_interval = timedelta ( seconds = settings . GARBAGE_COLLECTOR_INTERVAL_S ) ,
32- retry_after = timedelta ( minutes = 5 ) ,
32+ task_interval = interval ,
33+ retry_after = interval ,
3334 )
3435 async def _collect_garbage_periodically () -> None :
3536 with log_context (_logger , logging .INFO , "Garbage collect cycle" ):
Original file line number Diff line number Diff line change 2121def create_background_task_to_prune_trash (wait_s : float ) -> CleanupContextFunc :
2222
2323 async def _cleanup_ctx_fun (app : web .Application ) -> AsyncIterator [None ]:
24+ interval = timedelta (seconds = wait_s )
2425
2526 @exclusive_periodic (
2627 # Function-exclusiveness is required to avoid multiple tasks like thisone running concurrently
2728 get_redis_lock_manager_client_sdk (app ),
28- task_interval = timedelta ( seconds = wait_s ) ,
29- retry_after = timedelta ( minutes = 5 ) ,
29+ task_interval = interval ,
30+ retry_after = interval ,
3031 )
3132 async def _prune_trash_periodically () -> None :
3233 with log_context (_logger , logging .INFO , "Deleting expired trashed items" ):
Original file line number Diff line number Diff line change @@ -70,12 +70,13 @@ async def _update_expired_users(app: web.Application):
7070def create_background_task_for_trial_accounts (wait_s : float ) -> CleanupContextFunc :
7171
7272 async def _cleanup_ctx_fun (app : web .Application ) -> AsyncIterator [None ]:
73+ interval = timedelta (seconds = wait_s )
7374
7475 @exclusive_periodic (
7576 # Function-exclusiveness is required to avoid multiple tasks like thisone running concurrently
7677 get_redis_lock_manager_client_sdk (app ),
77- task_interval = timedelta ( seconds = wait_s ) ,
78- retry_after = timedelta ( minutes = 5 ) ,
78+ task_interval = interval ,
79+ retry_after = interval ,
7980 )
8081 async def _update_expired_users_periodically () -> None :
8182 with log_context (_logger , logging .INFO , "Updating expired users" ):
You can’t perform that action at this time.
0 commit comments