mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-22 08:44:10 +00:00
[commands] Only clean semaphore when there are no waiters
This commit is contained in:
parent
733962df12
commit
e21d49c980
@ -197,6 +197,9 @@ class _Semaphore:
|
||||
def locked(self):
|
||||
return self.value == 0
|
||||
|
||||
def is_active(self):
|
||||
return len(self._waiters) > 0
|
||||
|
||||
def wake_up(self):
|
||||
while self._waiters:
|
||||
future = self._waiters.popleft()
|
||||
@ -276,5 +279,5 @@ class MaxConcurrency:
|
||||
else:
|
||||
sem.release()
|
||||
|
||||
if sem.value >= self.number:
|
||||
if sem.value >= self.number and not sem.is_active():
|
||||
del self._mapping[key]
|
||||
|
Loading…
x
Reference in New Issue
Block a user