Commit 5adf85e4 authored by Bruno Martin's avatar Bruno Martin
Browse files

revoke task when clearing scheduled tasks;

remove unused code
parent 6f0cc301
......@@ -163,7 +163,6 @@ def create_or_update_events(instance, type):
else:
# case when not published but there is no release date and there is prior event
# import ipdb;ipdb.set_trace()
if type == 'course':
# less DRY please
try:
......@@ -196,17 +195,18 @@ def create_or_update_events(instance, type):
if event:
event.delete()
# case when not published but there is not release date and there is prior task scheduled
if not instance.release_date and st.release_date and st.task_hash:
app.control.revoke(st.task_hash)
st.delete()
def clear_scheduled_tasks(instance):
# import ipdb;ipdb.set_trace()
content_type = ContentType.objects.get_for_model(instance)
ScheduledTask.objects.filter(content_type=content_type, object_id=instance.id).delete()
try:
st = ScheduledTask.objects.get(content_type=content_type, object_id=instance.id)
if st.task_hash:
app.control.revoke(st.task_hash)
st.delete()
except ScheduledTask.DoesNotExist:
pass
@receiver(post_save, sender=Lesson)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment