Skip to content

Commit

Permalink
~ catch Entry.DoesNotExist
Browse files Browse the repository at this point in the history
  • Loading branch information
pmayer committed May 9, 2022
1 parent 3af7b69 commit 5a17c27
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/showroom_connector/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,16 @@ def relation_post_save(sender, instance, *args, **kwargs):
@receiver(post_delete, sender=Relation, dispatch_uid='showroom_connector_relation_post_delete')
def relation_post_delete(sender, instance, *args, **kwargs):
if settings.SYNC_TO_SHOWROOM:
if instance.from_entry.published and instance.to_entry.published:
queue = django_rq.get_queue('default')
queue.enqueue(sync.push_relations, entry=instance.from_entry)
# TODO: discuss and implement failure handling
try:
if instance.from_entry.published and instance.to_entry.published:
queue = django_rq.get_queue('default')
queue.enqueue(sync.push_relations, entry=instance.from_entry)
# TODO: discuss and implement failure handling
except Entry.DoesNotExist:
# Entry has already been deleted, so the corresponding request to
# Showroom should already have deleted all corresponding relations
# there as well, so it's not necessary to do anything further
pass


@receiver(post_save, sender=Media, dispatch_uid='showroom_connector_media_post_save')
Expand Down

0 comments on commit 5a17c27

Please sign in to comment.