openzeppelin_relayer/constants/
worker.rs

1pub const WORKER_DEFAULT_MAXIMUM_RETRIES: usize = 5;
2
3// Number of retries for the transaction request job
4pub const WORKER_TRANSACTION_REQUEST_RETRIES: usize = 5;
5
6// Transaction submission retry counts per command type
7pub const WORKER_TRANSACTION_SUBMIT_RETRIES: usize = 1; // Fresh transaction submission
8pub const WORKER_TRANSACTION_RESUBMIT_RETRIES: usize = 1; // Gas price bump (status checker will retry)
9pub const WORKER_TRANSACTION_CANCEL_RETRIES: usize = 1; // Cancel/replacement (status checker will retry)
10pub const WORKER_TRANSACTION_RESEND_RETRIES: usize = 1; // Resend same transaction (status checker will retry)
11
12// Number of retries for the transaction status checker job
13// Maximum retries for the transaction status checker job until tx is in final state
14pub const WORKER_TRANSACTION_STATUS_CHECKER_RETRIES: usize = usize::MAX;
15
16// Number of retries for the notification sender job
17pub const WORKER_NOTIFICATION_SENDER_RETRIES: usize = 5;
18
19// Number of retries for the token swap request job
20pub const WORKER_TOKEN_SWAP_REQUEST_RETRIES: usize = 2;
21
22// Number of retries for the transaction cleanup job
23pub const WORKER_TRANSACTION_CLEANUP_RETRIES: usize = 5;
24
25// Number of retries for the relayer health check job
26pub const WORKER_RELAYER_HEALTH_CHECK_RETRIES: usize = 2;
27
28// Number of retries for the system queue cleanup job
29pub const WORKER_SYSTEM_CLEANUP_RETRIES: usize = 3;
30
31// Default concurrency for the workers (fallback)
32pub const DEFAULT_CONCURRENCY: usize = 100;
33
34// Redis-only worker concurrency defaults (queues not represented in QueueType).
35// For QueueType-mapped queues, defaults are in QueueType::default_concurrency().
36pub const DEFAULT_CONCURRENCY_STATUS_CHECKER: usize = 50; // Generic/Solana
37pub const DEFAULT_CONCURRENCY_STATUS_CHECKER_EVM: usize = 100; // Highest volume (75% of jobs)
38
39// Cron schedule configurations (shared between Redis and SQS backends)
40/// Cron expression for transaction cleanup: runs every 10 minutes
41pub const TRANSACTION_CLEANUP_CRON_SCHEDULE: &str = "0 */10 * * * *";
42
43/// TTL for the transaction cleanup distributed lock (9 minutes).
44///
45/// This value should be:
46/// 1. Greater than the worst-case cleanup runtime to prevent concurrent execution
47/// 2. Less than the cron interval (10 minutes) to ensure availability for the next run
48pub const TRANSACTION_CLEANUP_LOCK_TTL_SECS: u64 = 9 * 60;
49
50/// Cron expression for system cleanup: runs every 15 minutes
51pub const SYSTEM_CLEANUP_CRON_SCHEDULE: &str = "0 */15 * * * *";
52
53/// TTL for the system cleanup distributed lock (14 minutes).
54///
55/// This value should be:
56/// 1. Greater than the worst-case cleanup runtime to prevent concurrent execution
57/// 2. Less than the cron interval (15 minutes) to ensure availability for the next run
58pub const SYSTEM_CLEANUP_LOCK_TTL_SECS: u64 = 14 * 60;
59
60/// Fallback TTL for token-swap cron distributed locks (4 minutes).
61///
62/// This fallback is used when the cron interval cannot be derived from the
63/// schedule expression (for example, parse failures). In normal operation,
64/// token-swap lock TTL is derived from the cron interval in SQS cron scheduler.
65pub const TOKEN_SWAP_CRON_LOCK_TTL_SECS: u64 = 4 * 60;