AuroraMeter. Oban. PlanTransitions
(Aurora Meter v1.0.0)
View Source
Applies scheduled plan changes whose effective date has arrived, by calling
AuroraMeter.Subscriptions.apply_due_transitions/1.
Recommended schedule "*/5 * * * *", which is what
AuroraMeter.Oban.cron_entries/1 returns. That interval is the delay a
host is choosing between a plan change's effective time and its
application, and between the two the tenant is entitled under the old
plan: conservative for a downgrade, visible to the customer for an upgrade.
A host that wants a tighter bound registers a more frequent entry or calls
the operation directly. See Plans for the measured lag.
Job arguments, all optional, all mapping onto the operation's options:
"limit": tenants per batch (default 500);"batches": batches per job (default 10, after which the remainder is left for the next tick);"tenant": force one tenant.
Running two of these at once, from two nodes, applies each transition once:
every effect in the operation is an update conditional on the transition
still being pending (invariant I16). The unique option below reduces
duplicate work and is never the guarantee.
Summary
Functions
Applies due transitions in at most "batches" pages, newest cursor first.
Functions
@spec perform(Oban.Job.t()) :: :ok | {:ok, term()} | {:error, term()} | {:cancel, term()}
Applies due transitions in at most "batches" pages, newest cursor first.
Returns {:ok, summary}; a run that stops at the batch bound reports
stopped: :partial, which is what an alert on a backlog that never drains
watches.
Examples
AuroraMeter.Oban.PlanTransitions.perform(%Oban.Job{args: %{"limit" => 100}})