diff options
| author | 2020-10-03 10:06:43 -0700 | |
|---|---|---|
| committer | 2020-10-03 10:06:43 -0700 | |
| commit | 73a0291a4ab4b10eb9d5d4e78bc574ca25fc9c98 (patch) | |
| tree | a87689714318a3048687f1def36e6bb3cabd83d5 | |
| parent | Reminders: fix conflict with the _can_modify check (diff) | |
Lock: rename variable to avoid shadowing
| -rw-r--r-- | bot/utils/lock.py | 6 |
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") |