Repository navigation
v0.21.0
Jobs can now run on a schedule, and the nightly bank fetch is the first one. The bank connection add-on is still switched off, so nothing changes for anyone today.
New, switched off
- Nightly bank fetch (#288). When a bank connection is completed, the company gets a schedule that fetches from the bank every night, at a default time spread per company between 02:00 and 04:59. It runs exactly what Hent nå runs. Whoever may reconcile the bank can change the times (at most four a day, because banks limit fetching without the user present) or pause it, from the Bankkobling card.
- A schedule writes nothing when there is nothing to fetch from: no live connection, no bank add-on, or a blocked subscription. It starts again by itself when that changes.
- A consent past its date ends the connection, as when the bank says the consent is gone. The user connects again.
New
- A general scheduler (docs/jobs.md, «Tidsplaner»). A schedule turns into an ordinary job when it is due, so claim-once, retries and several worker replicas come from the job machinery that already exists. Missed time is not made up for, and no run starts on top of an unfinished one. Which kinds of job can be scheduled, and how often, is decided in code.
- Tidsplaner tab in the platform console: what runs when, and how the last run went. No accounting data.
regnmed work --oncenow drains the queue instead of running one sweep.
Fixed
- Two bank fetches racing for the same lines (Hent nå while a scheduled fetch runs) no longer fail: the loser reports zero new lines.
Migrations: 0097_schedule (new table schedule, SQL function schedule_next, column job.schedule_id, job kind bank_sync; nothing existing is touched).
API: new GET /companies/{id}/schedules, PUT /companies/{id}/schedules/{kind} and GET /platform/schedules.
Operations: the worker now reads the optional secret bank-feed like the API does. At rollout the worker may log one relation "schedule" does not exist before the API's migration step has finished; it goes away on the next sweep, 30 seconds later.
Not in this release: cleanup of old job rows, buying the add-on, and notices before a consent expires.