fix: remove task on post_delete instead of pre_delete to handle possible deletion errors. import signal.
This commit is contained in:
parent
e1943b05f4
commit
cf6373c7cb
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue