Zizq.BudgetChange (Zizq v0.8.0)

Copy Markdown View Source

The outcome of changing the budgets of many jobs at once.

%Zizq.BudgetChange{changed: 12, blocked: ["01K9...", "01KA..."]}

:blocked

Only queued (:scheduled, :ready) jobs can be rebound: an in-flight job already debited against its budgets, and terminal jobs are immutable by design. Rather than skipping those silently, the server names the ones that would have changed but could not.

They are always in-flight jobs, so the list is a retry list — they drain on their own, and the same call afterwards will pick them up:

%{blocked: []} = MyApp.retry_until_clear(fn ->
  Zizq.query(MyApp.Zizq)
  |> Zizq.Query.where(queue: "emails")
  |> Zizq.Query.unbind_budget("stripe")
end)

A job that matched the filter and needed no change is counted in neither: it is not :changed, because nothing changed, and not :blocked, because nothing was in the way.

Summary

Functions

Whether every matching job was changed.

Types

t()

@type t() :: %Zizq.BudgetChange{blocked: [String.t()], changed: non_neg_integer()}

Functions

complete?(budget_change)

@spec complete?(t()) :: boolean()

Whether every matching job was changed.