Skip to content

Commit 1e974e6

Browse files
committed
reformat
refactor
1 parent 5c8fa1d commit 1e974e6

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

src/callback/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use alloy::rpc::types::Log;
22
use async_trait::async_trait;
33

4+
pub mod strategy;
5+
46
#[async_trait]
57
pub trait EventCallback {
68
/// Called when a matching log is found.
79
async fn on_event(&self, log: &Log) -> anyhow::Result<()>;
810
}
9-
10-
pub mod strategy;

src/callback/strategy/fixed_retry.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ use crate::callback::EventCallback;
88

99
use super::CallbackStrategy;
1010

11+
pub const BACK_OFF_MAX_RETRIES: u64 = 5;
12+
pub const BACK_OFF_MAX_DELAY_MS: u64 = 200;
13+
1114
#[derive(Clone, Copy, Debug)]
1215
pub struct FixedRetryConfig {
1316
pub max_attempts: u64,
1417
pub delay_ms: u64,
1518
}
1619

17-
pub const BACK_OFF_MAX_RETRIES: u64 = 5;
18-
pub const BACK_OFF_MAX_DELAY_MS: u64 = 200;
19-
2020
impl Default for FixedRetryConfig {
2121
fn default() -> Self {
2222
Self { max_attempts: BACK_OFF_MAX_RETRIES, delay_ms: BACK_OFF_MAX_DELAY_MS }

src/callback/strategy/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ use async_trait::async_trait;
55

66
use crate::callback::EventCallback;
77

8+
pub mod fixed_retry;
9+
pub mod state_sync_aware;
10+
11+
pub use fixed_retry::{BACK_OFF_MAX_RETRIES, FixedRetryConfig, FixedRetryStrategy};
12+
pub use state_sync_aware::{StateSyncAwareStrategy, StateSyncConfig};
13+
814
#[async_trait]
915
pub trait CallbackStrategy: Send + Sync {
1016
async fn execute(
@@ -13,9 +19,3 @@ pub trait CallbackStrategy: Send + Sync {
1319
log: &Log,
1420
) -> anyhow::Result<()>;
1521
}
16-
17-
pub mod fixed_retry;
18-
pub mod state_sync_aware;
19-
20-
pub use fixed_retry::{BACK_OFF_MAX_RETRIES, FixedRetryConfig, FixedRetryStrategy};
21-
pub use state_sync_aware::{StateSyncAwareStrategy, StateSyncConfig};

src/callback/strategy/state_sync_aware.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ use crate::{FixedRetryConfig, callback::EventCallback};
88

99
use super::{CallbackStrategy, fixed_retry::FixedRetryStrategy};
1010

11+
pub const STATE_SYNC_RETRY_INTERVAL: Duration = Duration::from_secs(30);
12+
pub const STATE_SYNC_RETRY_MAX_INTERVAL: Duration = Duration::from_secs(120);
13+
pub const STATE_SYNC_RETRY_MAX_ELAPSED: Duration = Duration::from_secs(600);
14+
pub const STATE_SYNC_RETRY_MULTIPLIER: f64 = 1.5;
15+
1116
#[derive(Clone, Copy, Debug)]
1217
pub struct StateSyncConfig {
1318
pub initial_interval: Duration,
@@ -16,11 +21,6 @@ pub struct StateSyncConfig {
1621
pub multiplier: f64,
1722
}
1823

19-
pub const STATE_SYNC_RETRY_INTERVAL: Duration = Duration::from_secs(30);
20-
pub const STATE_SYNC_RETRY_MAX_INTERVAL: Duration = Duration::from_secs(120);
21-
pub const STATE_SYNC_RETRY_MAX_ELAPSED: Duration = Duration::from_secs(600);
22-
pub const STATE_SYNC_RETRY_MULTIPLIER: f64 = 1.5;
23-
2424
impl Default for StateSyncConfig {
2525
fn default() -> Self {
2626
Self {

0 commit comments

Comments
 (0)