sui_indexer_alt_framework::task

Function with_slow_future_monitor

Source
pub async fn with_slow_future_monitor<F, C>(
    future: F,
    threshold: Duration,
    callback: C,
) -> F::Output
where F: Future, C: FnOnce(),
Expand description

Wraps a future with slow/stuck detection using tokio::select!

This implementation races the future against a timer. If the timer expires first, the callback is executed (exactly once) but the future continues to run. This approach can detect stuck futures that never wake their waker.