Skip to content

Commit

Permalink
Fixing redis locking for 5000 seconds unintentionally (#5)
Browse files Browse the repository at this point in the history
Co-authored-by: Karl Jin <karl@users.noreply.github.com>
  • Loading branch information
karljin and karl committed Apr 20, 2021
1 parent 5e3c9b1 commit 40c929c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions umeboshi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@


@contextlib.contextmanager
def simple_lock(lock_key, timeout=5000):
def simple_lock(lock_key, timeout=5000, redis_timeout_sec=5):
"""
A simple context manager that raises the passed exception
if a lock can't be acquired.
"""

acquire_lock = lambda: cache.add(lock_key, 1, timeout)
acquire_lock = lambda: cache.add(lock_key, 1, redis_timeout_sec)
release_lock = lambda: cache.delete(lock_key)

waited, hops = 0, 10
Expand Down

0 comments on commit 40c929c

Please sign in to comment.