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