11import functools
2+ import logging
23from collections .abc import Awaitable , Callable , Coroutine
34from typing import Any , Final , ParamSpec , TypeVar
45
56from models_library .projects import ProjectID
67from models_library .projects_access import Owner
78from models_library .projects_state import ProjectLocked , ProjectStatus
9+ from servicelib .logging_utils import log_catch
810
911from ._client import RedisClientSDK
1012from ._decorators import exclusive
1113from ._errors import CouldNotAcquireLockError , ProjectLockError
1214
1315_PROJECT_REDIS_LOCK_KEY : Final [str ] = "project_lock:{}"
1416
17+ _logger = logging .getLogger (__name__ )
1518
1619P = ParamSpec ("P" )
1720R = TypeVar ("R" )
@@ -59,7 +62,8 @@ async def _wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
5962 )
6063 async def _exclusive_func (* args , ** kwargs ) -> R :
6164 if notification_cb is not None :
62- await notification_cb ()
65+ with log_catch (_logger , reraise = False ):
66+ await notification_cb ()
6367 return await func (* args , ** kwargs )
6468
6569 try :
@@ -70,7 +74,8 @@ async def _exclusive_func(*args, **kwargs) -> R:
7074 finally :
7175 # we are now unlocked
7276 if notification_cb is not None :
73- await notification_cb ()
77+ with log_catch (_logger , reraise = False ):
78+ await notification_cb ()
7479
7580 return _wrapper
7681
0 commit comments