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
29 changes: 29 additions & 0 deletions contracts/predictify-hybrid/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4017,6 +4017,35 @@ impl EventEmitter {
(addresses.clone(), admin.clone(), env.ledger().timestamp()),
);
}

/// Emit a monitor queue overflow event when the bounded queue evicts the oldest entry.
///
/// This event signals that the queue was at capacity and a new event caused an
/// eviction. Off-chain indexers should consume this to track data loss and adjust
/// their polling cadence accordingly.
///
/// # Arguments
///
/// * `env` - The Soroban environment.
/// * `overflow_count` - Cumulative number of overflow evictions since initialization.
/// * `evicted_event_id` - The `event_id` of the evicted `MonitorEvent`, if available.
/// * `capacity` - The configured capacity of the bounded queue.
pub fn emit_monitor_queue_overflow(
env: &Env,
overflow_count: u64,
evicted_event_id: Option<Symbol>,
capacity: u32,
) {
env.events().publish(
(symbol_short!("mon_ovf"),),
(
overflow_count,
evicted_event_id,
capacity,
env.ledger().timestamp(),
),
);
}
}

// ===== EVENT LOGGING AND MONITORING =====
Expand Down
Loading
Loading