From cf6373c7cb9e586fbed52160deefc84665ea55e6 Mon Sep 17 00:00:00 2001 From: Jan Koppe Date: Sun, 31 May 2020 18:34:51 +0200 Subject: [PATCH] fix: remove task on post_delete instead of pre_delete to handle possible deletion errors. import signal. --- restream/signals.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/restream/signals.py b/restream/signals.py index 5427a38..23da109 100644 --- a/restream/signals.py +++ b/restream/signals.py @@ -1,5 +1,5 @@ from django.dispatch import receiver -from django.db.models.signals import post_save +from django.db.models.signals import post_save, post_delete from rtmp.signals import stream_active from .models import RestreamConfig from rtmp.models import Stream @@ -35,7 +35,7 @@ def update_tasks(sender, **kwargs): task.save() -@receiver(pre_delete, sender=RestreamConfig) +@receiver(post_delete, sender=RestreamConfig) def delete_tasks(sender, **kwargs): instance = kwargs['instance'] # Get the current task instance if it exists, and remove it