fffleet-orchestrator 2.8.0 → 2.9.0

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/job-store.js +14 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fffleet-orchestrator",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "fffleet orchestrator: schedules ffmpeg jobs across a pool of fffleet workers",
5
5
  "type": "module",
6
6
  "main": "./src/orchestrator.js",
@@ -21,7 +21,7 @@
21
21
  "test": "node --test test/*.test.js"
22
22
  },
23
23
  "dependencies": {
24
- "fffleet": "^2.8.0"
24
+ "fffleet": "^2.9.0"
25
25
  },
26
26
  "keywords": [
27
27
  "ffmpeg",
package/src/job-store.js CHANGED
@@ -9,7 +9,20 @@
9
9
  * The built-in one is a SQLite file through `node:sqlite`, loaded only when asked for (Node 22.13 or later).
10
10
  */
11
11
 
12
+ import { withoutInlinePayload } from 'fffleet';
13
+
12
14
  const FIELDS = ['state', 'workerId', 'createdAt', 'startedAt', 'finishedAt', 'progress', 'exitCode', 'error', 'outputs', 'stderrTail', 'seq', 'order', 'history'];
15
+
16
+ /** Inline results (a report's `data`, a `base64` payload) are not persisted, in the outputs or in the event history. */
17
+ function persistable(job) {
18
+ const data = {};
19
+ for (const key of FIELDS) data[key] = job[key];
20
+ if (Array.isArray(data.outputs)) data.outputs = data.outputs.map(withoutInlinePayload);
21
+ if (Array.isArray(data.history)) {
22
+ data.history = data.history.map(e => (Array.isArray(e.outputs) ? { ...e, outputs: e.outputs.map(withoutInlinePayload) } : e));
23
+ }
24
+ return data;
25
+ }
13
26
  const SCHEMA_VERSION = 1;
14
27
 
15
28
  /** @param {string} file */
@@ -40,9 +53,7 @@ export async function openSqliteJobStore(file) {
40
53
 
41
54
  return {
42
55
  save(job) {
43
- const data = { spec: job.spec };
44
- for (const key of FIELDS) data[key] = job[key];
45
- upsert.run(job.id, job.order, job.final ? 1 : 0, JSON.stringify(data));
56
+ upsert.run(job.id, job.order, job.final ? 1 : 0, JSON.stringify({ spec: job.spec, ...persistable(job) }));
46
57
  },
47
58
  loadAll() {
48
59
  const out = [];