GoodJob.Job.State (good_job v1.0.0)

Copy Markdown View Source

Job state calculation logic.

Calculates job state from timestamp fields.

Summary

Functions

Calculates the job state from timestamp fields. Returns :available, :running, :succeeded, :discarded, :scheduled, or :retried

Functions

calculate(job, current_time \\ nil)

@spec calculate(GoodJob.Job.t(), DateTime.t() | nil) :: atom()

Calculates the job state from timestamp fields. Returns :available, :running, :succeeded, :discarded, :scheduled, or :retried

Optimized version that accepts optional current_time to avoid repeated DateTime.utc_now() calls.