Path: redb-route/redb.Route/Processors/InflightWaits.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route/Processors/InflightWaits.cs
----
using redb.Route.Abstractions;
using redb.Route.Core;
namespace redb.Route.Processors;
///
/// Marks the planned waits of the engine (redelivery delays, the delay step) in the route context's in-flight
/// registry, so a monitor tells an exchange that waits by design from a hung one.
///
internal static class InflightWaits
{
/// Waits with the exchange marked as waiting for that long.
public static async Task DelayAsync(IExchange exchange, TimeSpan delay, CancellationToken ct)
{
using (Begin(exchange, delay))
await Task.Delay(delay, ct).ConfigureAwait(false);
}
private static IDisposable? Begin(IExchange exchange, TimeSpan delay)
=> (exchange.Context as RouteContext)?.InflightRepository.BeginWait(exchange.ExchangeId, delay);
}