File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
packages/service-library/src/servicelib/redis Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 2323R = TypeVar ("R" )
2424
2525_EXCLUSIVE_TASK_NAME : Final [str ] = "exclusive/{module_name}.{func_name}"
26- _EXCLUSIVE_AUTO_EXTEND_TASK_NAME : Final [
27- str
28- ] = "exclusive/autoextend_lock_{redis_lock_key}"
26+ _EXCLUSIVE_AUTO_EXTEND_TASK_NAME : Final [str ] = (
27+ "exclusive/autoextend_lock_{redis_lock_key}"
28+ )
2929
3030
3131@periodic (interval = DEFAULT_LOCK_TTL / 2 , raise_on_error = True )
@@ -134,10 +134,15 @@ async def _wrapper(*args: P.args, **kwargs: P.kwargs) -> R:
134134 assert len (lock_lost_errors .exceptions ) == 1 # nosec
135135 raise lock_lost_errors .exceptions [0 ] from eg
136136 finally :
137- with contextlib . suppress ( redis . exceptions . LockNotOwnedError ) :
137+ try :
138138 # in the case where the lock would have been lost,
139139 # this would raise again and is not necessary
140140 await lock .release ()
141+ except redis .exceptions .LockNotOwnedError :
142+ _logger .exception (
143+ "Unexpected error with lock '%s', cannot release it" ,
144+ redis_lock_key ,
145+ )
141146
142147 return _wrapper
143148
You can’t perform that action at this time.
0 commit comments