Module: Batchwatch::PollState

Defined in:
lib/batchwatch/job.rb

Overview

The outcome of a single non-blocking poll - the async/worker driver's view.

BatchJob#poll_once returns one of these constants so a caller driving the loop from their own event loop (rather than letting #result block a thread) can decide what to do next without reading provider internals:

  • RUNNING - not terminal yet; sleep next_interval and poll again.
  • DONE - terminal and successful; call #result for the value.
  • EXPIRED - terminal via the 24h expiry; a DISTINCT state, never a silent timeout, so the caller can tell "the queue was slow" from "the batch failed".
  • FAILED - terminal but not successful (failed / cancelled).

EXPIRED and FAILED both fall back the same way inside #result; they are kept separate here because the caller - and #180's measurement - must be able to tell them apart.

Constant Summary collapse

RUNNING =
"running"
DONE =
"done"
EXPIRED =
"expired"
FAILED =
"failed"