pub struct StatusCheckContext {
pub consecutive_failures: u32,
pub total_failures: u32,
pub total_retries: u32,
pub max_consecutive_failures: u32,
pub max_total_failures: u32,
pub network_type: NetworkType,
}Expand description
Context for status check circuit breaker decisions.
This struct is passed to network handlers during status checks to provide failure tracking information. Handlers can use this to decide whether to force-finalize a transaction that has exceeded the maximum retry attempts.
The circuit breaker triggers when EITHER threshold is exceeded:
consecutive_failures >= max_consecutive_failures(RPC completely down)total_failures >= max_total_failures(flaky RPC, safety net)
§Example
let context = StatusCheckContext::new(
consecutive_failures,
total_failures,
total_retries,
max_consecutive_failures,
max_total_failures,
NetworkType::Stellar,
);
if context.should_force_finalize() {
// Mark transaction as Failed with appropriate reason
}Fields§
§consecutive_failures: u32Number of consecutive failures since last successful status check. Resets to 0 when a status check succeeds (even if transaction not final).
total_failures: u32Total number of failures across all status check attempts. Never resets - serves as safety net for flaky RPC connections.
total_retries: u32Total number of retries (from Apalis attempt counter). Includes both successful and failed attempts.
max_consecutive_failures: u32Maximum consecutive failures allowed before forcing finalization. Network-specific value from constants.
max_total_failures: u32Maximum total failures allowed before forcing finalization. Safety net for flaky RPC that occasionally succeeds (resetting consecutive counter).
network_type: NetworkTypeThe network type for this transaction.
Implementations§
Source§impl StatusCheckContext
impl StatusCheckContext
Sourcepub fn new(
consecutive_failures: u32,
total_failures: u32,
total_retries: u32,
max_consecutive_failures: u32,
max_total_failures: u32,
network_type: NetworkType,
) -> Self
pub fn new( consecutive_failures: u32, total_failures: u32, total_retries: u32, max_consecutive_failures: u32, max_total_failures: u32, network_type: NetworkType, ) -> Self
Creates a new StatusCheckContext with the specified failure counts and limits.
§Arguments
consecutive_failures- Current count of consecutive failurestotal_failures- Total count of all failurestotal_retries- Total Apalis retry attempts (includes successes)max_consecutive_failures- Network-specific consecutive max before force-finalizationmax_total_failures- Network-specific total max (safety net)network_type- The blockchain network type
Sourcepub fn should_force_finalize(&self) -> bool
pub fn should_force_finalize(&self) -> bool
Determines if the circuit breaker should force-finalize the transaction.
Returns true if EITHER threshold is exceeded:
- Consecutive failures reached the network-specific maximum (RPC completely down)
- Total failures reached the network-specific maximum (flaky RPC safety net)
Sourcepub fn triggered_by_consecutive(&self) -> bool
pub fn triggered_by_consecutive(&self) -> bool
Returns true if triggered by consecutive failures threshold.
Sourcepub fn triggered_by_total(&self) -> bool
pub fn triggered_by_total(&self) -> bool
Returns true if triggered by total failures threshold (safety net).
Trait Implementations§
Source§impl Clone for StatusCheckContext
impl Clone for StatusCheckContext
Source§fn clone(&self) -> StatusCheckContext
fn clone(&self) -> StatusCheckContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StatusCheckContext
impl Debug for StatusCheckContext
Auto Trait Implementations§
impl Freeze for StatusCheckContext
impl RefUnwindSafe for StatusCheckContext
impl Send for StatusCheckContext
impl Sync for StatusCheckContext
impl Unpin for StatusCheckContext
impl UnwindSafe for StatusCheckContext
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more