File tree Expand file tree Collapse file tree 3 files changed +58
-6
lines changed
proof_aggregator/src/backend Expand file tree Collapse file tree 3 files changed +58
-6
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,27 @@ use crate::types::Receipt;
22use db:: { orchestrator:: DbOrchestartor , retry:: RetryConfig } ;
33use sqlx:: types:: { BigDecimal , Uuid } ;
44
5- // Retry parameters for Db queries
5+ // Retry/backoff behavior summary (see
6+ // aggregation_mode/db/src/orchestrator.rs:next_back_off_delay for implementation)
7+ //
8+ // NOTE: These retry limits are intentionally lower than in other crates.
9+ // This code runs in an HTTP server; in the worst case the request fails fast
10+ // and the client can retry the request. Prolonged blocking retries here are
11+ // less critical than in background or batch processing jobs.
12+ //
13+ // 1) Max wait time between failures if all retries fail:
14+ // The sleep between retries is capped at 10 seconds (RETRY_MAX_DELAY_SECONDS).
15+ //
16+ // 2) Wait before each retry attempt with the current config
17+ // (start = 500ms, factor = 2.0, max retries = 4):
18+ //
19+ // retry 1: 0.5s
20+ // retry 2: 1.0s
21+ // retry 3: 2.0s
22+ // retry 4: 4.0s
23+ //
24+ // Worst-case total sleep time across all retries: 7.5 seconds,
25+ // plus the execution time of each DB attempt.
626/// Initial delay before first retry attempt (in milliseconds)
727const RETRY_MIN_DELAY_MILLIS : u64 = 500 ;
828/// Exponential backoff multiplier for retry delays
Original file line number Diff line number Diff line change 11use db:: { orchestrator:: DbOrchestartor , retry:: RetryConfig } ;
22use sqlx:: types:: BigDecimal ;
33
4- // Retry parameters for Db queries
4+ // Retry/backoff behavior summary for DB queries (see
5+ // aggregation_mode/db/src/orchestrator.rs:next_back_off_delay for implementation)
6+ //
7+ // 1) Max wait time between failures if all retries fail:
8+ // The sleep between retries is capped at 30 seconds (RETRY_MAX_DELAY_SECONDS).
9+ //
10+ // 2) Wait before each retry attempt with the current config
11+ // (start = 500ms, factor = 4.0, max retries = 5):
12+ //
13+ // retry 1: 0.5s
14+ // retry 2: 2.0s
15+ // retry 3: 8.0s
16+ // retry 4: 30s (capped; 32s would have been next)
17+ // retry 5: 30s
18+ //
19+ // Worst-case total sleep time across all retries: 70.5 seconds -> 5 blocks of ethereum waiting,
20+ // plus the execution time of each DB attempt.
521/// Initial delay before first retry attempt (in milliseconds)
622const RETRY_MIN_DELAY_MILLIS : u64 = 500 ;
723/// Exponential backoff multiplier for retry delays
8- const RETRY_FACTOR : f32 = 2 .0;
24+ const RETRY_FACTOR : f32 = 4 .0;
925/// Maximum number of retry attempts
1026const RETRY_MAX_TIMES : usize = 5 ;
1127/// Maximum delay between retry attempts (in seconds)
Original file line number Diff line number Diff line change 11use db:: { orchestrator:: DbOrchestartor , retry:: RetryConfig , types:: Task } ;
22use sqlx:: types:: Uuid ;
33
4- // Retry parameters for Db queries
4+ // Retry/backoff behavior summary (see
5+ // aggregation_mode/db/src/orchestrator.rs:next_back_off_delay for implementation)
6+ //
7+ // 1) Max wait time between failures if all retries fail:
8+ // The sleep between retries is capped at 30 seconds (RETRY_MAX_DELAY_SECONDS).
9+ //
10+ // 2) Wait before each retry attempt with the current config
11+ // (start = 500ms, factor = 5.0, max retries = 10):
12+ //
13+ // retry 1: 0.5s
14+ // retry 2: 2.5s
15+ // retry 3: 12.5s
16+ // retry 4: 30s (capped)
17+ // retry 5–10: 30s each
18+ //
19+ // Worst-case total sleep time across all retries: ~3m 48s,
20+ // plus the execution time of each DB attempt.
521/// Initial delay before first retry attempt (in milliseconds)
622const RETRY_MIN_DELAY_MILLIS : u64 = 500 ;
723/// Exponential backoff multiplier for retry delays
8- const RETRY_FACTOR : f32 = 2 .0;
24+ const RETRY_FACTOR : f32 = 5 .0;
925/// Maximum number of retry attempts
10- const RETRY_MAX_TIMES : usize = 5 ;
26+ const RETRY_MAX_TIMES : usize = 10 ;
1127/// Maximum delay between retry attempts (in seconds)
1228const RETRY_MAX_DELAY_SECONDS : u64 = 30 ;
1329
You can’t perform that action at this time.
0 commit comments