Kantoor.Feeds.Scheduler (Kantoor v1.0.0)

Starts the refresh of subscriptions that are due. Every replica runs one; none is special. Each tick reads the due subscriptions from Postgres (Kantoor.Feeds.due/2) and runs Kantoor.Feeds.Refresh for them in a Task.Supervisor (at most 10 at a time per replica). When two replicas pick the same subscription, the claim in Kantoor.Feeds.Refresh.run/2 lets one fetch it and the other do nothing.

Configuration (config :kantoor, Kantoor.Feeds.Scheduler): :enabled (true), :interval_ms (30_000), :first_run_ms (random up to 30 s after boot), :batch (20).

Summary

Functions

Returns a specification to start this module under a supervisor.

Runs one tick now, in the caller: starts the due refreshes and returns their count. Option :now (tests) is the time to judge what is due by.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

tick(opts \\ [])

@spec tick(keyword()) :: non_neg_integer()

Runs one tick now, in the caller: starts the due refreshes and returns their count. Option :now (tests) is the time to judge what is due by.