Relyra.Workers.MetadataRefresh (relyra v1.1.0)

Copy Markdown View Source

Optional Oban worker that drives Relyra.Metadata.Scheduler.run_due/2 per D-02. Compiles whether or not Oban is in the adopter's deps tree (Pitfall 5 — mix compile --no-optional-deps --warnings-as-errors lane).

Adopters add ONE Cron line to their host config:

config :my_app, Oban,
  repo: MyApp.Repo,
  queues: [relyra_metadata: 1],
  plugins: [
    {Oban.Plugins.Cron,
     crontab: [
       {"*/15 * * * *", Relyra.Workers.MetadataRefresh,
        args: %{"repo" => "MyApp.Repo"}}
     ]}
  ]

The 15-minute Cron interval is fine even though Phase 21 cadence presets are 1h+ — Scheduler.run_due/2 only acts on rows whose next_refresh_at is in the past, so an empty tick just emits the :skipped event (D-07) and returns.

unique: constraint per D-03: at most one in-flight job per source_id across the entire Oban cluster. Multi-node dedup is delegated to Oban.Peers.Database leader election.