Skip to content

symfonic.services.effects.drain

drain

EFX-F-4 โ€” the bounded drain, and what happens to what does not drain.

Operations admitted before the revert's linearization point need an explicit path, and "wait for them" is not one: a wedged worker would hold the incident open forever. So the drain is time-boxed against the same clock the leases use, and everything still open when the budget runs out is contained โ€” named, marked, and carried into the incident rather than assumed finished.

Containment is not a synonym for success. A contained ticket is one the fence stopped from committing but whose in-flight state the framework could not observe to completion, which is exactly the state an operator needs to see.

BoundedDrain

BoundedDrain(tracker: InFlightTracker, *, clock: Callable[[], float] = time.time, sleep: Callable[[float], Awaitable[None]] = _default_sleep, interval: float = 0.05, budget: float = 5.0)

Waits, briefly, for in-flight work to reach a terminal state.

Source code in src/symfonic/services/effects/drain.py
def __init__(
    self,
    tracker: InFlightTracker,
    *,
    clock: Callable[[], float] = time.time,
    sleep: Callable[[float], Awaitable[None]] = _default_sleep,
    interval: float = 0.05,
    budget: float = 5.0,
) -> None:
    self._tracker = tracker
    self._clock = clock
    self._sleep = sleep
    self._interval = interval
    self._budget = budget

DrainReport dataclass

DrainReport(drained: tuple[str, ...], contained: tuple[str, ...], budget: float, elapsed: float)

What the drain observed. complete is false if anything was contained.