Poll Failure Tracker
Track poll failures for the PaSD bus and report them as a snapshot.
- class PollFailureSnapshot(fndh_total, fncc_total, smartbox_totals, fndh_in_window, fncc_in_window, smartbox_in_window)
Immutable snapshot of poll-failure state.
Carries both cumulative counts (since the tracker was created) and the number of failures observed within the most recent sliding window.
- __init__(fndh_total, fncc_total, smartbox_totals, fndh_in_window, fncc_in_window, smartbox_in_window)
- class PollFailureTracker(window, prune_interval, logger, on_changed)
Track and report poll failures for the PaSD bus.
Whenever state changes (a new failure is recorded or a sliding window value is re-calculated), a single PollFailureSnapshot is delivered to the
on_changedcallback.- __init__(window, prune_interval, logger, on_changed)
Initialise a new instance.
- Parameters:
window (
float) – sliding-window length in seconds.prune_interval (
float) – how often (seconds) to prune expired timestamps.logger (
Logger) – logger for this object to use.on_changed (
Callable[[PollFailureSnapshot],None]) – callable invoked with a fresh snapshot whenever the cumulative or windowed counts change.
- record_poll_failure(device_id)
Record a failed poll for a PaSD device.
Increments the cumulative counter for the device, appends a timestamp to its sliding window, and emits a snapshot if the resulting state differs from the previous one.