From b43fa4556e729728cf4e173c73d782a4f53370bf Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 5 Aug 2018 14:21:01 +0200 Subject: [PATCH] Fix the retry --- tasks.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tasks.py b/tasks.py index 15c27a7..d1c3356 100644 --- a/tasks.py +++ b/tasks.py @@ -320,10 +320,7 @@ def finish_post_to_inbox(self, iri: str) -> None: try: activity = ap.fetch_remote_activity(iri) log.info(f"activity={activity!r}") - except (ActivityGoneError, ActivityNotFoundError): - log.exception(f"no retry") - try: if activity.has_type(ap.ActivityType.DELETE): back.inbox_delete(MY_PERSON, activity) elif activity.has_type(ap.ActivityType.UPDATE): @@ -346,6 +343,8 @@ def finish_post_to_inbox(self, iri: str) -> None: back.inbox_undo_announce(MY_PERSON, obj) elif obj.has_type(ap.ActivityType.FOLLOW): back.undo_new_follower(MY_PERSON, obj) + except (ActivityGoneError, ActivityNotFoundError): + log.exception(f"no retry") except Exception as err: log.exception(f"failed to cache attachments for {iri}") self.retry(exc=err, countdown=int(random.uniform(2, 4) ** self.request.retries)) @@ -370,10 +369,7 @@ def finish_post_to_outbox(self, iri: str) -> None: try: activity = ap.fetch_remote_activity(iri) log.info(f"activity={activity!r}") - except (ActivityGoneError, ActivityNotFoundError): - log.exception(f"no retry") - try: recipients = activity.recipients() if activity.has_type(ap.ActivityType.DELETE): @@ -402,6 +398,8 @@ def finish_post_to_outbox(self, iri: str) -> None: for recp in recipients: log.debug(f"posting to {recp}") post_to_remote_inbox.delay(payload, recp) + except (ActivityGoneError, ActivityNotFoundError): + log.exception(f"no retry") except Exception as err: log.exception(f"failed to post to remote inbox for {iri}") self.retry(exc=err, countdown=int(random.uniform(2, 4) ** self.request.retries))