Fix the retry
This commit is contained in:
parent
57c6c765b6
commit
b43fa4556e
1 changed files with 4 additions and 6 deletions
10
tasks.py
10
tasks.py
|
@ -320,10 +320,7 @@ def finish_post_to_inbox(self, iri: str) -> None:
|
||||||
try:
|
try:
|
||||||
activity = ap.fetch_remote_activity(iri)
|
activity = ap.fetch_remote_activity(iri)
|
||||||
log.info(f"activity={activity!r}")
|
log.info(f"activity={activity!r}")
|
||||||
except (ActivityGoneError, ActivityNotFoundError):
|
|
||||||
log.exception(f"no retry")
|
|
||||||
|
|
||||||
try:
|
|
||||||
if activity.has_type(ap.ActivityType.DELETE):
|
if activity.has_type(ap.ActivityType.DELETE):
|
||||||
back.inbox_delete(MY_PERSON, activity)
|
back.inbox_delete(MY_PERSON, activity)
|
||||||
elif activity.has_type(ap.ActivityType.UPDATE):
|
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)
|
back.inbox_undo_announce(MY_PERSON, obj)
|
||||||
elif obj.has_type(ap.ActivityType.FOLLOW):
|
elif obj.has_type(ap.ActivityType.FOLLOW):
|
||||||
back.undo_new_follower(MY_PERSON, obj)
|
back.undo_new_follower(MY_PERSON, obj)
|
||||||
|
except (ActivityGoneError, ActivityNotFoundError):
|
||||||
|
log.exception(f"no retry")
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
log.exception(f"failed to cache attachments for {iri}")
|
log.exception(f"failed to cache attachments for {iri}")
|
||||||
self.retry(exc=err, countdown=int(random.uniform(2, 4) ** self.request.retries))
|
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:
|
try:
|
||||||
activity = ap.fetch_remote_activity(iri)
|
activity = ap.fetch_remote_activity(iri)
|
||||||
log.info(f"activity={activity!r}")
|
log.info(f"activity={activity!r}")
|
||||||
except (ActivityGoneError, ActivityNotFoundError):
|
|
||||||
log.exception(f"no retry")
|
|
||||||
|
|
||||||
try:
|
|
||||||
recipients = activity.recipients()
|
recipients = activity.recipients()
|
||||||
|
|
||||||
if activity.has_type(ap.ActivityType.DELETE):
|
if activity.has_type(ap.ActivityType.DELETE):
|
||||||
|
@ -402,6 +398,8 @@ def finish_post_to_outbox(self, iri: str) -> None:
|
||||||
for recp in recipients:
|
for recp in recipients:
|
||||||
log.debug(f"posting to {recp}")
|
log.debug(f"posting to {recp}")
|
||||||
post_to_remote_inbox.delay(payload, recp)
|
post_to_remote_inbox.delay(payload, recp)
|
||||||
|
except (ActivityGoneError, ActivityNotFoundError):
|
||||||
|
log.exception(f"no retry")
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
log.exception(f"failed to post to remote inbox for {iri}")
|
log.exception(f"failed to post to remote inbox for {iri}")
|
||||||
self.retry(exc=err, countdown=int(random.uniform(2, 4) ** self.request.retries))
|
self.retry(exc=err, countdown=int(random.uniform(2, 4) ** self.request.retries))
|
||||||
|
|
Loading…
Reference in a new issue