Honker.Job (honker v0.1.4)

Copy Markdown

A claimed unit of work. Use the lifecycle helpers (ack/2, retry/4, fail/3, heartbeat/3) to close it out.

The struct itself is a plain data carrier — all state lives in the database; Elixir just holds a snapshot of the row.

Summary

Functions

DELETE the row iff the claim hasn't expired. Returns {:ok, bool}.

Unconditionally move the claim to _honker_dead.

Extend the visibility timeout by extend_s seconds.

Put the job back with delay_s, or move to _honker_dead after max_attempts. Returns {:ok, bool} — true iff the claim was still valid (either path qualifies).

Functions

ack(database, job)

DELETE the row iff the claim hasn't expired. Returns {:ok, bool}.

fail(database, job, error)

Unconditionally move the claim to _honker_dead.

heartbeat(database, job, extend_s)

Extend the visibility timeout by extend_s seconds.

retry(database, job, delay_s, error)

Put the job back with delay_s, or move to _honker_dead after max_attempts. Returns {:ok, bool} — true iff the claim was still valid (either path qualifies).