mirror of
https://github.com/LemmyNet/activitypub-federation-rust
synced 2024-11-10 06:04:19 +00:00
Only retry activity sending at most 3 times (#7)
This commit is contained in:
parent
d59614f68d
commit
5d670513d6
1 changed files with 9 additions and 13 deletions
|
@ -110,19 +110,15 @@ impl ActixJob for SendActivityTask {
|
|||
type Future = Pin<Box<dyn Future<Output = Result<(), anyhow::Error>>>>;
|
||||
const NAME: &'static str = "SendActivityTask";
|
||||
|
||||
/// With these params, retries are made at the following intervals:
|
||||
/// 3s
|
||||
/// 9s
|
||||
/// 27s
|
||||
/// 1m 21s
|
||||
/// 4m 3s
|
||||
/// 12m 9s
|
||||
/// 36m 27s
|
||||
/// 1h 49m 21s
|
||||
/// 5h 28m 3s
|
||||
/// 16h 24m 9s
|
||||
const MAX_RETRIES: MaxRetries = MaxRetries::Count(10);
|
||||
const BACKOFF: Backoff = Backoff::Exponential(3);
|
||||
/// We need to retry activity sending in case the target instances is temporarily unreachable.
|
||||
/// In this case, the task is stored and resent when the instance is hopefully back up. This
|
||||
/// list shows the retry intervals, and which events of the target instance can be covered:
|
||||
/// - 60s (one minute, service restart)
|
||||
/// - 60min (one hour, instance maintenance)
|
||||
/// - 60h (2.5 days, major incident with rebuild from backup)
|
||||
/// TODO: make the intervals configurable
|
||||
const MAX_RETRIES: MaxRetries = MaxRetries::Count(3);
|
||||
const BACKOFF: Backoff = Backoff::Exponential(60);
|
||||
|
||||
fn run(self, state: Self::State) -> Self::Future {
|
||||
Box::pin(async move { do_send(self, &state.client, state.timeout).await })
|
||||
|
|
Loading…
Reference in a new issue