aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-10-03 10:06:43 -0700
committerGravatar MarkKoz <[email protected]>2020-10-03 10:06:43 -0700
commit73a0291a4ab4b10eb9d5d4e78bc574ca25fc9c98 (patch)
treea87689714318a3048687f1def36e6bb3cabd83d5
parentReminders: fix conflict with the _can_modify check (diff)
Lock: rename variable to avoid shadowing
-rw-r--r--bot/utils/lock.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/bot/utils/lock.py b/bot/utils/lock.py
index 5c9dd3725..510f41234 100644
--- a/bot/utils/lock.py
+++ b/bot/utils/lock.py
@@ -81,11 +81,11 @@ def lock(namespace: Hashable, resource_id: ResourceId, *, raise_error: bool = Fa
# Get the lock for the ID. Create a lock if one doesn't exist yet.
locks = __lock_dicts[namespace]
- lock = locks.setdefault(id_, LockGuard())
+ lock_guard = locks.setdefault(id_, LockGuard())
- if not lock.locked():
+ if not lock_guard.locked():
log.debug(f"{name}: resource {namespace!r}:{id_!r} is free; acquiring it...")
- with lock:
+ with lock_guard:
return await func(*args, **kwargs)
else:
log.info(f"{name}: aborted because resource {namespace!r}:{id_!r} is locked")