Skip to content

Commit 60c4397

Browse files
committed
ensure lock removal is notified in case of error
1 parent a3ad1e9 commit 60c4397

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/service-library/src/servicelib/redis/_project_lock.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,14 @@ async def _exclusive_func(*args, **kwargs) -> R:
6363
return await func(*args, **kwargs)
6464

6565
try:
66-
result = await _exclusive_func(*args, **kwargs)
66+
return await _exclusive_func(*args, **kwargs)
67+
68+
except CouldNotAcquireLockError as e:
69+
raise ProjectLockError from e
70+
finally:
6771
# we are now unlocked
6872
if notification_cb is not None:
6973
await notification_cb()
70-
return result
71-
except CouldNotAcquireLockError as e:
72-
raise ProjectLockError from e
7374

7475
return _wrapper
7576

0 commit comments

Comments
 (0)