fix(timers): Stop creating timer zombies.

Don't try to recreate a destroyed timer from an option setting.
This commit is contained in:
2023-09-12 01:49:51 +03:00
parent 14541899e0
commit f248cfdab0
3 changed files with 30 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ class Timer:
'_voice_update_lock',
'_run_task',
'_loop_task',
'destroyed',
)
break_name = _p('timer|stage:break|name', "BREAK")
@@ -79,6 +80,8 @@ class Timer:
# Main loop task. Should not be cancelled.
self._loop_task = None
self.destroyed = False
def __repr__(self):
return (
"<Timer "
@@ -729,6 +732,7 @@ class Timer:
self._run_task.cancel()
channelid = self.data.channelid
await self.data.delete()
self.destroyed = True
if self.last_status_message:
try:
await self.last_status_message.delete()