@volter/supercode-orchestrator 0.5.12 → 0.5.13
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.
- package/board/event-stream.mjs +13 -10
- package/package.json +1 -1
package/board/event-stream.mjs
CHANGED
|
@@ -15,14 +15,18 @@ const RESETTLE_MS = 30_000;
|
|
|
15
15
|
export async function* followBoardPublications({root,after,signal}) {
|
|
16
16
|
const home=identity(root), positions={}, watchers=new Map();
|
|
17
17
|
let dirty=true, wake=null, failure=null, inventory=null;
|
|
18
|
-
//
|
|
19
|
-
// the board, which rewrites the WAL and raises a watch event of its own; an event
|
|
20
|
-
// pass left it is that echo, not a change, and does not start another pass.
|
|
21
|
-
// every
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
// Each store file as this follower's own pass left it, stamped right after that board's close. Its pass writes (the
|
|
19
|
+
// publication transaction) and closes the board, which rewrites the WAL and raises a watch event of its own; an event
|
|
20
|
+
// for a store file that is still as its pass left it is that echo, not a change, and does not start another pass.
|
|
21
|
+
// Without this the follower woke itself every quarter second and burned a core with nothing to publish
|
|
22
|
+
// (t_0328d520). Stamped per board, a write to one board while later boards' passes run is never taken for an echo.
|
|
23
|
+
let stores=[];
|
|
24
|
+
const settled=new Map();
|
|
25
|
+
const statOf=path=>{try{const s=statSync(path);return `${s.size}:${s.mtimeMs}`;}catch{return '-';}};
|
|
24
26
|
const notify=(name=null)=>{
|
|
25
|
-
|
|
27
|
+
const named=name===null?[]:stores.filter(path=>basename(path)===name);
|
|
28
|
+
// A store file no pass stamps (the root's kanban.db where only named boards exist) reads '-' until one does.
|
|
29
|
+
if(named.length&&named.every(path=>statOf(path)===(settled.get(path)??'-')))return;
|
|
26
30
|
dirty=true;wake?.();
|
|
27
31
|
};
|
|
28
32
|
const directory=(path,accept)=>{
|
|
@@ -90,12 +94,11 @@ export async function* followBoardPublications({root,after,signal}) {
|
|
|
90
94
|
for(const row of rows){positions[slug].sequence=row.sequence;yield {type:'event',id:row.id,kind:row.kind,cursor:cursorOf(home,positions),data:{board:slug,card:JSON.parse(row.snapshot)}};}
|
|
91
95
|
}
|
|
92
96
|
}
|
|
93
|
-
}finally{board.close();}
|
|
97
|
+
}finally{board.close();const paths=backingPaths(root,slug);for(const path of [paths.sqlite,`${paths.sqlite}-wal`])settled.set(path,statOf(path));}
|
|
94
98
|
}
|
|
95
99
|
if(initial){initial=false;yield {type:'snapshot_end',cursor:cursorOf(home,positions)};dirty=true;}
|
|
96
100
|
else if(checkpointPending){checkpointPending=false;yield {type:'checkpoint',cursor:cursorOf(home,positions)};}
|
|
97
|
-
|
|
98
|
-
// A write that lands between the pass and the stamp above has its event taken for this pass's echo: a pass
|
|
101
|
+
// A write that lands between a board's close and its stamp has its event taken for that pass's echo: a pass
|
|
99
102
|
// every RESETTLE_MS anyway bounds how long that write can wait.
|
|
100
103
|
let timer=null;
|
|
101
104
|
if(!dirty&&!signal?.aborted)await new Promise(done=>{wake=done;timer=setTimeout(()=>{dirty=true;done();},RESETTLE_MS);timer.unref?.();if(dirty||signal?.aborted)done();});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-orchestrator",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The orchestrator runtime over the Volter Harness ontology: one typed operational model whose folder is its serialization, read and written through the harness orchestration doors (docs/ORCHESTRATOR-IR.md)",
|
|
6
6
|
"exports": {
|