Zizq.Filter (Zizq v0.6.1)

Copy Markdown View Source

Filters shared by every endpoint that selects jobs.

Zizq.list_jobs/2, Zizq.count_jobs/2 and the bulk operations all narrow the same way, so the vocabulary is described once here.

Zizq.count_jobs([queue: "emails", status: [:ready, :scheduled]], MyApp.Zizq)

Options

  • :id — one job id, or a list of them.
  • :queue — one queue name, or a list.
  • :type — one job type, or a list.
  • :status — one status atom, or a list.
  • :priority — a number, a Range, or [min: _, max: _].
  • :ready_at — the same, over DateTimes or milliseconds.
  • :attempts — the same, over attempt counts.
  • :filter — a jq expression run against each payload, e.g. ".user_id == 42".

An option left out does not narrow anything. A list matches any of its members, so status: [:ready, :scheduled] finds jobs in either.

Ranges

Ranges are inclusive at both ends. A bare number matches exactly:

priority: 5           # exactly 5
priority: 1..10       # 1 to 10
priority: [min: 5]    # 5 and above
priority: [max: 5]    # 5 and below

:ready_at accepts DateTimes as well as milliseconds, so a window reads as one:

ready_at: [min: DateTime.utc_now()]