drain_timeout_has_headroom
Function
This function is defined in the protocols module.Return whether the supervisor stop-timeout leaves room to drain. Pure predicate used by a startup sanity check. A supervisor whose stop-timeout is shorter than
drain_timeout + headroom will SIGKILL
the gateway mid-drain, leaving no explanation. This returns False only
when we can prove the headroom is insufficient; when either value is
unknown (None) or non-positive it returns True (fail-open: do not
emit a spurious warning when we cannot tell).
Signature
Parameters
Optional[float]
required
The supervisor’s configured stop-timeout in seconds, or
None when it could not be determined.Optional[float]
required
The gateway’s configured drain timeout in seconds, or
None/0 when draining is disabled.float
default:"30.0"
Slack to reserve beyond the drain window for teardown.
Returns
bool
True when there is adequate headroom (or it cannot be determined),
False only when the stop-timeout is provably too short.Source
View on GitHub
praisonaiagents/gateway/protocols.py at line 4224
