anbaric 1.56.6 → 1.56.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,6 +49,7 @@ Used by the store implementations the factories return:
49
49
  | `ANBARIC_SQL_DATABASE_URL` | PostgreSQL | connection string |
50
50
  | `ANBARIC_SQL_SCHEMA` | PostgreSQL | schema name (default `anbaric_app_data`) |
51
51
  | `ANBARIC_FILE_STORAGE_PATH` | local file storage | directory to keep files in (default `<temp dir>/anbaric/files`) |
52
+ | `ANBARIC_SCHEDULER_TICK_MS` | the job run scheduler | how often due runs are checked for, in milliseconds (default `10000`) |
52
53
 
53
54
  ## Platform-injected variables
54
55
 
@@ -348,6 +348,13 @@ Storage comes from `JobRunSchedulePersistenceFactory` — in memory locally, the
348
348
  platform database when deployed, where claiming a due run is atomic so several
349
349
  instances can schedule the same machines safely.
350
350
 
351
+ Claiming coalesces: when more than one of a machine's runs has come due — the
352
+ scheduler was down, a deploy took a while — only the most recent is claimed
353
+ and started, and the earlier ones are recorded as **superseded** by it
354
+ (`superseded_at` and `superseded_by` on the stored run). The consumer is sent
355
+ one catch-up job, never one per missed tick. Runs of different machines, or
356
+ of the same machine in different apps, are never coalesced with each other.
357
+
351
358
  ---
352
359
 
353
360
  ## `Actor`
@@ -53,10 +53,14 @@ runs as they come due. Two things follow from that, both deliberate:
53
53
 
54
54
  - **A restart doesn't lose the timetable.** The plan is already stored, so the
55
55
  scheduler picks up where it left off.
56
- - **Downtime doesn't silently skip runs.** A scheduler that was down for two
57
- days starts the runs it missed as soon as it comes back, rather than
58
- pretending they never existed. If you don't want that catch-up for a
59
- particular machine, make its action check `scheduledFor` and return early.
56
+ - **Downtime doesn't silently skip runs — and doesn't replay them either.** A
57
+ scheduler that was down for two days starts **one** catch-up run as soon as
58
+ it comes back: the most recent run it missed. The earlier missed runs are
59
+ recorded as superseded by it, so the timetable shows what was skipped and
60
+ why, but an hourly sync that missed a day never becomes twenty-four syncs
61
+ fired in the same second. The job's `scheduledFor` tells you which run it
62
+ is; if a machine must not catch up at all, make its action check that and
63
+ return early.
60
64
 
61
65
  Every scheduled job carries the run it belongs to:
62
66
 
@@ -69,6 +73,9 @@ processRun.run = async (job) => {
69
73
 
70
74
  ## Spreading the load
71
75
 
76
+ The scheduler checks for due runs every ten seconds (`ANBARIC_SCHEDULER_TICK_MS`
77
+ changes that), so a run starts within ten seconds of its planned time.
78
+
72
79
  Machines scheduled at the same time would otherwise all start on the same
73
80
  second. Each machine gets a small random offset — up to two minutes by default —
74
81
  applied **when the run is planned**, so the stored time is the time it really
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anbaric",
3
- "version": "1.56.6",
3
+ "version": "1.56.8",
4
4
  "description": "Everything needed to write an Anbaric app: state machines, jobs, document and secret stores, local in-memory implementations and the Anbaric Cloud clients",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,9 +24,9 @@
24
24
  "prepublishOnly": "npm run build"
25
25
  },
26
26
  "dependencies": {
27
- "anbaric-impl-cloud": "^1.56.6",
28
- "anbaric-data-store": "^1.56.6",
29
- "anbaric-state-machine": "^1.56.6",
30
- "anbaric-tsapi": "^1.56.6"
27
+ "anbaric-impl-cloud": "^1.56.8",
28
+ "anbaric-data-store": "^1.56.8",
29
+ "anbaric-state-machine": "^1.56.8",
30
+ "anbaric-tsapi": "^1.56.8"
31
31
  }
32
32
  }