From 03c16d6c996afebefdbcc8807a0f489017d3ed5c Mon Sep 17 00:00:00 2001 From: thiswillbeyourgithub Date: Tue, 4 Oct 2022 12:55:51 +0200 Subject: [PATCH] feat: remove any alarm given an action Signed-off-by: thiswillbeyourgithub --- wasp/wasp.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wasp/wasp.py b/wasp/wasp.py index b24fa01..d505326 100644 --- a/wasp/wasp.py +++ b/wasp/wasp.py @@ -351,7 +351,12 @@ class Manager(): def cancel_alarm(self, time, action): """Unqueue an alarm.""" try: - self._alarms.remove((time, action)) + if time is None: + for i, al in enumerate(self._alarms): + if self._alarms[i][1] == action: + self._alarms.remove(self._alarms[i]) + else: + self._alarms.remove((time, action)) except: return False return True