Skip to content

Commit 5aaf9db

Browse files
Update redis/lock.py to catch Both LockNotOwnedError and LockError in one except statement as LockError.
Co-authored-by: Juliano Amadeu <[email protected]>
1 parent 1bfb7e0 commit 5aaf9db

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

redis/lock.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,10 @@ def __exit__(
180180
) -> None:
181181
try:
182182
self.release()
183-
except LockNotOwnedError:
184-
if self.raise_on_release_error:
185-
raise
186-
logger.warning("Lock was no longer owned when exiting context manager.")
187183
except LockError:
188184
if self.raise_on_release_error:
189185
raise
190-
logger.warning("Lock was unlocked when exiting context manager.")
186+
logger.warning("Lock was unlocked or no longer owned when exiting context manager.")
191187

192188
def acquire(
193189
self,

0 commit comments

Comments
 (0)