LemmyNet / activitypub-federation-rust

High-level Rust library for the Activitypub protocol
GNU Affero General Public License v3.0
409 stars 46 forks source link

do_send should retry failed connections #41

Closed null-dev closed 1 year ago

null-dev commented 1 year ago

I see on this line that if the send fails due to a connection error, it does not get retried:

https://github.com/LemmyNet/activitypub-federation-rust/blob/6ac6e2d90efa818d9644f7f09346d3657e65f32d/src/activity_queue.rs#L193

But there are cases where it should definitely retry. For example, today lemmy.ml is overloaded so many subscribe operations are not going through:

lemmy-lemmy-1     | 2023-06-12T14:51:09.410929Z DEBUG Worker{worker.id=867f1e83-24de-4363-a3ff-ee742f67c9b6 worker.queue=default worker.operation.id=9f4792c7-e83a-44f7-9536-236e48b82cd8 worker.operation.name=process}:Job{execution_id=b12ecf19-efec-4438-a352-9612c22d384b job.id=272231c7-803d-4f7f-a35d-d7800e0fe08b job.name=SendActivityTask}: activitypub_federation::core::activity_queue: Sending https://lemmy.vepta.org/activities/follow/f4dc629c-297a-47b2-bb75-cac9ece6d1f4 to https://lemmy.ml/inbox    
lemmy-lemmy-1     | 2023-06-12T14:51:19.414603Z  INFO Worker{worker.id=867f1e83-24de-4363-a3ff-ee742f67c9b6 worker.queue=default worker.operation.id=9f4792c7-e83a-44f7-9536-236e48b82cd8 worker.operation.name=process}:Job{execution_id=b12ecf19-efec-4438-a352-9612c22d384b job.id=272231c7-803d-4f7f-a35d-d7800e0fe08b job.name=SendActivityTask}: activitypub_federation::core::activity_queue: Unable to connect to https://lemmy.ml/inbox, aborting task https://lemmy.vepta.org/activities/follow/f4dc629c-297a-47b2-bb75-cac9ece6d1f4: Request error: error sending request for url (https://lemmy.ml/inbox): operation timed out

If the operation is not retried, the user will never be subscribed unless they manually re-subscribe.

Nutomic commented 1 year ago

That makes sense. Would you make a PR?