Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions crates/config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,20 @@ impl Config {
);
}

if self.tap.allocation_reconciliation_interval_secs == Duration::ZERO {
return Err(
"tap.allocation_reconciliation_interval_secs must be greater than 0".to_string(),
);
}

if self.tap.allocation_reconciliation_interval_secs < Duration::from_secs(60) {
tracing::warn!(
"Your `tap.allocation_reconciliation_interval_secs` value is too low. \
This may cause unnecessary load on the system. \
A recommended value is at least 60 seconds."
);
}

// Horizon configuration validation
// Explicit toggle via `horizon.enabled`. When enabled, require both
// `blockchain.subgraph_service_address` and
Expand Down Expand Up @@ -441,6 +455,23 @@ pub struct TapConfig {
/// over the escrow balance
#[serde(default)]
pub trusted_senders: HashSet<Address>,

/// Interval in seconds for periodic allocation reconciliation.
///
/// Allocation state is normally updated via watcher events from the network subgraph.
/// However, if connectivity to the subgraph is lost, allocation closure events may be
/// missed. This periodic reconciliation forces a re-check of all allocations against
/// the current subgraph state, ensuring stale allocations are detected and processed
/// even after connectivity failures.
///
/// Default: 300 (5 minutes)
#[serde(default = "default_allocation_reconciliation_interval_secs")]
#[serde_as(as = "DurationSecondsWithFrac<f64>")]
pub allocation_reconciliation_interval_secs: Duration,
}

fn default_allocation_reconciliation_interval_secs() -> Duration {
Duration::from_secs(300)
}

#[derive(Debug, Deserialize)]
Expand Down
1 change: 1 addition & 0 deletions crates/tap-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ test-log = { workspace = true, features = ["trace"] }
rstest.workspace = true
stdext.workspace = true
insta.workspace = true
tokio = { workspace = true, features = ["test-util"] }
Loading
Loading