fix: remove any alarm given an action
Signed-off-by: thiswillbeyourgithub <github@32mail.33mail.com>
This commit is contained in:
parent
1ad2ee1d66
commit
81e38a85b0
1 changed files with 5 additions and 5 deletions
10
wasp/wasp.py
10
wasp/wasp.py
|
@ -350,13 +350,13 @@ class Manager():
|
|||
|
||||
def cancel_alarm(self, time, action):
|
||||
"""Unqueue an alarm."""
|
||||
alarms = self._alarms
|
||||
try:
|
||||
if time is None:
|
||||
for i, al in enumerate(self._alarms):
|
||||
if self._alarms[i][1] == action:
|
||||
self._alarms.remove(self._alarms[i])
|
||||
if not time:
|
||||
time_to_remove = [al[0] for al in alarms if al[1] == action]
|
||||
[alarms.remove((t, action)) for t in time_to_remove]
|
||||
else:
|
||||
self._alarms.remove((time, action))
|
||||
alarms.remove((time, action))
|
||||
except:
|
||||
return False
|
||||
return True
|
||||
|
|
Loading…
Reference in a new issue