@indigoai-us/hq-cloud 6.18.43-alpha.2 → 6.18.43
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/dist/bandwidth.d.ts +2 -3
- package/dist/bandwidth.d.ts.map +1 -1
- package/dist/bandwidth.js +16 -21
- package/dist/bandwidth.js.map +1 -1
- package/dist/bandwidth.test.js +0 -23
- package/dist/bandwidth.test.js.map +1 -1
- package/dist/bin/sync-runner-heap-telemetry.d.ts +0 -3
- package/dist/bin/sync-runner-heap-telemetry.d.ts.map +1 -1
- package/dist/bin/sync-runner-heap-telemetry.js +0 -3
- package/dist/bin/sync-runner-heap-telemetry.js.map +1 -1
- package/dist/bin/sync-runner-watch-loop.d.ts +2 -25
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +8 -82
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner-watch-routes.d.ts +1 -3
- package/dist/bin/sync-runner-watch-routes.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-routes.js +0 -13
- package/dist/bin/sync-runner-watch-routes.js.map +1 -1
- package/dist/bin/sync-runner.d.ts +1 -2
- package/dist/bin/sync-runner.d.ts.map +1 -1
- package/dist/bin/sync-runner.js.map +1 -1
- package/dist/bin/sync-runner.test.js +4 -297
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/cli/index.d.ts +3 -7
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +1 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/journal-snapshot-rows.d.ts +0 -2
- package/dist/journal-snapshot-rows.d.ts.map +1 -1
- package/dist/journal-snapshot-rows.js +0 -4
- package/dist/journal-snapshot-rows.js.map +1 -1
- package/dist/sync/parallel-sync-coordinator.d.ts +0 -7
- package/dist/sync/parallel-sync-coordinator.d.ts.map +1 -1
- package/dist/sync/parallel-sync-coordinator.js +0 -22
- package/dist/sync/parallel-sync-coordinator.js.map +1 -1
- package/dist/sync/parallel-sync-coordinator.test.js +0 -31
- package/dist/sync/parallel-sync-coordinator.test.js.map +1 -1
- package/dist/sync/realtime-telemetry.d.ts +2 -24
- package/dist/sync/realtime-telemetry.d.ts.map +1 -1
- package/dist/sync/realtime-telemetry.js +3 -47
- package/dist/sync/realtime-telemetry.js.map +1 -1
- package/dist/sync/realtime-telemetry.test.js +8 -47
- package/dist/sync/realtime-telemetry.test.js.map +1 -1
- package/package.json +1 -1
- package/dist/daemon.d.ts +0 -12
- package/dist/daemon.d.ts.map +0 -1
- package/dist/daemon.js +0 -90
- package/dist/daemon.js.map +0 -1
|
@@ -3,7 +3,7 @@ import { readJournal } from "../journal.js";
|
|
|
3
3
|
import { type FeatureSwitch } from "../sync/feature-flags.js";
|
|
4
4
|
import { HeapCensus } from "./sync-runner-heap-telemetry.js";
|
|
5
5
|
import { FullPassCapController } from "../sync/full-pass-caps.js";
|
|
6
|
-
import { type
|
|
6
|
+
import { type RealtimeTelemetryReason } from "../sync/realtime-telemetry.js";
|
|
7
7
|
import { type PathWorkOutcome } from "../sync/sync-work.js";
|
|
8
8
|
import type { TelemetryClaims } from "../telemetry-events.js";
|
|
9
9
|
import type { JournalEntry } from "../types.js";
|
|
@@ -79,12 +79,6 @@ export interface GuardedPassContext {
|
|
|
79
79
|
/** Aborted when the caller cancels the slice. */
|
|
80
80
|
signal: AbortSignal;
|
|
81
81
|
}
|
|
82
|
-
/** `choreKind` is the coordinator chore kind of the holding entry; absent for a chore outside the coordinator. */
|
|
83
|
-
export type SchedulerBlocker = {
|
|
84
|
-
workClass: GuardedWorkClass;
|
|
85
|
-
lane: "fast" | "slow";
|
|
86
|
-
choreKind?: string;
|
|
87
|
-
};
|
|
88
82
|
/**
|
|
89
83
|
* One durable-state owner at a time for a full chore. Realtime work runs only
|
|
90
84
|
* while that chore is suspended at `checkpoint()`. Only coordinator-fenced
|
|
@@ -94,12 +88,6 @@ export type SchedulerBlocker = {
|
|
|
94
88
|
* pre-existing scoped fast-over-slow exception, but never while a chore owns
|
|
95
89
|
* durable state.
|
|
96
90
|
*/
|
|
97
|
-
/**
|
|
98
|
-
* Maps what holds a realtime op to its closed telemetry label. A chore kind
|
|
99
|
-
* outside the label set becomes `chore:unscoped`, so a new kind can never
|
|
100
|
-
* make the timing record fail its low-cardinality check.
|
|
101
|
-
*/
|
|
102
|
-
export declare function realtimeBlockerLabel(blocker: SchedulerBlocker): RealtimeBlocker;
|
|
103
91
|
export declare class CooperativePassScheduler<T> {
|
|
104
92
|
private readonly now;
|
|
105
93
|
private readonly starvationCapMs;
|
|
@@ -109,8 +97,6 @@ export declare class CooperativePassScheduler<T> {
|
|
|
109
97
|
/** Realtime executes started by the current hand-off. Not the chore slot. */
|
|
110
98
|
private readonly realtimeOccupants;
|
|
111
99
|
private handoffBacklog;
|
|
112
|
-
/** The chore suspended at checkpoint() while it lends the slot. Diagnostics only. */
|
|
113
|
-
private handoffOwner;
|
|
114
100
|
private handoffDeferredAt;
|
|
115
101
|
private handoffAdmitted;
|
|
116
102
|
private occupantEpoch;
|
|
@@ -140,16 +126,7 @@ export declare class CooperativePassScheduler<T> {
|
|
|
140
126
|
/** Includes the running slow/fast lanes and hand-off occupants; it never changes their cap. */
|
|
141
127
|
get activeRealtimeWorkerCount(): number;
|
|
142
128
|
pendingLaneCount(lane: "fast" | "slow"): number;
|
|
143
|
-
submit(task: (context: GuardedPassContext) => Promise<T>, workClass: GuardedWorkClass, lane?: "fast" | "slow", allowFastRealtimeOvertake?: boolean, signal?: AbortSignal, resourceCap?: boolean, allowConcurrentHandoff?: boolean, transferDirection?: "push" | "pull", transferSizeClass?: "small" | "large" | "unknown"
|
|
144
|
-
/** Diagnostics only: called once if this task queues, naming what holds the scheduler. */
|
|
145
|
-
onQueued?: (blocker: SchedulerBlocker) => void, choreKind?: string): Promise<T>;
|
|
146
|
-
/**
|
|
147
|
-
* Diagnostics only: the work holding a task that cannot start. The occupant
|
|
148
|
-
* of the task's own lane comes first, then the slot owner, then a hand-off
|
|
149
|
-
* occupant that is what refuses admission, then the chore lending the slot.
|
|
150
|
-
*/
|
|
151
|
-
private blockerFor;
|
|
152
|
-
private blockingOccupant;
|
|
129
|
+
submit(task: (context: GuardedPassContext) => Promise<T>, workClass: GuardedWorkClass, lane?: "fast" | "slow", allowFastRealtimeOvertake?: boolean, signal?: AbortSignal, resourceCap?: boolean, allowConcurrentHandoff?: boolean, transferDirection?: "push" | "pull", transferSizeClass?: "small" | "large" | "unknown"): Promise<T>;
|
|
153
130
|
stop(): void;
|
|
154
131
|
private abortedError;
|
|
155
132
|
/** Realtime stays ahead of a queued full chore so retries are not buried. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-runner-watch-loop.d.ts","sourceRoot":"","sources":["../../src/bin/sync-runner-watch-loop.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sync-runner-watch-loop.d.ts","sourceRoot":"","sources":["../../src/bin/sync-runner-watch-loop.ts"],"names":[],"mappings":"AAmCA,OAAO,EAML,KAAK,UAAU,EAEf,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAUL,WAAW,EAYZ,MAAM,eAAe,CAAC;AAevB,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AASlC,OAAO,EACL,UAAU,EA0CX,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EAEL,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AAOnC,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,eAAe,EAIrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAahD,OAAO,KAAK,EACV,yBAAyB,EACzB,SAAS,EAET,cAAc,EACd,iBAAiB,EAElB,MAAM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QAAQ,GAAG,WAAW,GAC3B,KAAK,CAAC,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CASvC;AAED;;;;;;;GAOG;AACH,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,SAAS,EACzC,gBAAgB,EAAE,MAAM,GACvB,MAAM,GAAG,SAAS,CAQpB;AAWD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oCAAoC,CAClD,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAIT;AAeD,wBAAgB,0CAA0C,CACxD,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAET;AA8ED,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CAqoIjB"}
|
|
@@ -2,7 +2,6 @@ import * as os from "os";
|
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import * as fs from "fs";
|
|
4
4
|
import { MULTIPART_PART_SIZE_BYTES } from "../sync/multipart-uploader.js";
|
|
5
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
5
|
import * as v8 from "node:v8";
|
|
7
6
|
import { performance } from "node:perf_hooks";
|
|
8
7
|
import { inventoryManagedSnapshots } from "../backup-prune.js";
|
|
@@ -37,7 +36,7 @@ import { SESSION_LOGS_PUSH_ONLY_PREFIX } from "../sync/pull-scope.js";
|
|
|
37
36
|
import { createHqFlagsCapSource, FullPassCapController, isFullPassDurableProgressEnabled, } from "../sync/full-pass-caps.js";
|
|
38
37
|
import { canSkipScheduledFullReconcile, FullPassContinuity, isFullPassJournalHealthy, } from "../sync/idle-full-reconcile.js";
|
|
39
38
|
import { DEFAULT_REALTIME_AUTHORIZATION_TIMEOUT_MS } from "../sync/realtime-rollout.js";
|
|
40
|
-
import { RealtimeTelemetrySpan, writeRealtimeTelemetryToStderr,
|
|
39
|
+
import { RealtimeTelemetrySpan, writeRealtimeTelemetryToStderr, } from "../sync/realtime-telemetry.js";
|
|
41
40
|
import { InlineSyncWorkerAdapter, } from "../sync/sync-work.js";
|
|
42
41
|
import { buildRoutePullArgv, buildScopedPushArgv, buildScopedDrainPullArgv, buildTargetedPullArgv, isWatchRouteSelected, routeChangeToTarget, routeKey, scopePathForRoute, } from "./sync-runner-watch-routes.js";
|
|
43
42
|
import { resolveSkipCompanies } from "./sync-runner-planning.js";
|
|
@@ -185,17 +184,6 @@ export function allowConcurrentHandoffForGuardedWork(workClass, explicitlyAllowe
|
|
|
185
184
|
* pre-existing scoped fast-over-slow exception, but never while a chore owns
|
|
186
185
|
* durable state.
|
|
187
186
|
*/
|
|
188
|
-
/**
|
|
189
|
-
* Maps what holds a realtime op to its closed telemetry label. A chore kind
|
|
190
|
-
* outside the label set becomes `chore:unscoped`, so a new kind can never
|
|
191
|
-
* make the timing record fail its low-cardinality check.
|
|
192
|
-
*/
|
|
193
|
-
export function realtimeBlockerLabel(blocker) {
|
|
194
|
-
if (blocker.workClass === "realtime")
|
|
195
|
-
return `realtime:${blocker.lane}`;
|
|
196
|
-
const label = `chore:${blocker.choreKind ?? "unscoped"}`;
|
|
197
|
-
return REALTIME_BLOCKERS.includes(label) ? label : "chore:unscoped";
|
|
198
|
-
}
|
|
199
187
|
export class CooperativePassScheduler {
|
|
200
188
|
now;
|
|
201
189
|
starvationCapMs;
|
|
@@ -205,8 +193,6 @@ export class CooperativePassScheduler {
|
|
|
205
193
|
/** Realtime executes started by the current hand-off. Not the chore slot. */
|
|
206
194
|
realtimeOccupants = new Set();
|
|
207
195
|
handoffBacklog = null;
|
|
208
|
-
/** The chore suspended at checkpoint() while it lends the slot. Diagnostics only. */
|
|
209
|
-
handoffOwner = null;
|
|
210
196
|
handoffDeferredAt = null;
|
|
211
197
|
handoffAdmitted = false;
|
|
212
198
|
occupantEpoch = 0;
|
|
@@ -253,9 +239,7 @@ export class CooperativePassScheduler {
|
|
|
253
239
|
pendingLaneCount(lane) {
|
|
254
240
|
return this.pending.filter((entry) => entry.lane === lane).length;
|
|
255
241
|
}
|
|
256
|
-
submit(task, workClass, lane = "slow", allowFastRealtimeOvertake = false, signal, resourceCap = workClass === "chore", allowConcurrentHandoff = false, transferDirection, transferSizeClass = "unknown"
|
|
257
|
-
/** Diagnostics only: called once if this task queues, naming what holds the scheduler. */
|
|
258
|
-
onQueued, choreKind) {
|
|
242
|
+
submit(task, workClass, lane = "slow", allowFastRealtimeOvertake = false, signal, resourceCap = workClass === "chore", allowConcurrentHandoff = false, transferDirection, transferSizeClass = "unknown") {
|
|
259
243
|
if (this.stopped)
|
|
260
244
|
return Promise.resolve(0);
|
|
261
245
|
if (signal?.aborted) {
|
|
@@ -274,7 +258,6 @@ export class CooperativePassScheduler {
|
|
|
274
258
|
allowConcurrentHandoff,
|
|
275
259
|
transferDirection,
|
|
276
260
|
transferSizeClass,
|
|
277
|
-
...(workClass === "chore" && choreKind !== undefined ? { choreKind } : {}),
|
|
278
261
|
// An immediately admitted task cannot starve, so avoid sampling the
|
|
279
262
|
// cadence clock merely to stamp it. This preserves the loop's deadline
|
|
280
263
|
// accounting and keeps the timestamp meaningful only for real queues.
|
|
@@ -334,49 +317,10 @@ export class CooperativePassScheduler {
|
|
|
334
317
|
this.withinHandoffAdmission()) {
|
|
335
318
|
entry.occupancyArrival = true;
|
|
336
319
|
}
|
|
337
|
-
const holder = this.blockerFor(entry);
|
|
338
320
|
this.enqueuePending(entry);
|
|
339
321
|
this.drain();
|
|
340
|
-
if (onQueued && holder && this.pending.includes(entry)) {
|
|
341
|
-
try {
|
|
342
|
-
onQueued({
|
|
343
|
-
workClass: holder.workClass,
|
|
344
|
-
lane: holder.lane,
|
|
345
|
-
...(holder.choreKind !== undefined ? { choreKind: holder.choreKind } : {}),
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
catch {
|
|
349
|
-
// Diagnostics must never affect admission.
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
322
|
});
|
|
353
323
|
}
|
|
354
|
-
/**
|
|
355
|
-
* Diagnostics only: the work holding a task that cannot start. The occupant
|
|
356
|
-
* of the task's own lane comes first, then the slot owner, then a hand-off
|
|
357
|
-
* occupant that is what refuses admission, then the chore lending the slot.
|
|
358
|
-
*/
|
|
359
|
-
blockerFor(entry) {
|
|
360
|
-
const ownLane = entry.lane === "fast" ? this.activeFastRealtime : null;
|
|
361
|
-
return ownLane ??
|
|
362
|
-
this.active ??
|
|
363
|
-
this.blockingOccupant(entry) ??
|
|
364
|
-
this.detachedChore ??
|
|
365
|
-
this.handoffOwner ??
|
|
366
|
-
this.activeFastRealtime ??
|
|
367
|
-
this.pending.find((pending) => pending !== entry);
|
|
368
|
-
}
|
|
369
|
-
blockingOccupant(entry) {
|
|
370
|
-
if (entry.workClass !== "realtime" || !this._handoffActive)
|
|
371
|
-
return null;
|
|
372
|
-
const occupants = [...this.realtimeOccupants];
|
|
373
|
-
const sameDirection = entry.transferDirection === undefined
|
|
374
|
-
? undefined
|
|
375
|
-
: occupants.find((occupant) => occupant.transferDirection === entry.transferDirection);
|
|
376
|
-
if (sameDirection)
|
|
377
|
-
return sameDirection;
|
|
378
|
-
return occupants.length >= REALTIME_WORKER_OCCUPANCY_CAP ? occupants[0] ?? null : null;
|
|
379
|
-
}
|
|
380
324
|
stop() {
|
|
381
325
|
this.stopped = true;
|
|
382
326
|
this.active?.controller.abort();
|
|
@@ -857,7 +801,6 @@ export class CooperativePassScheduler {
|
|
|
857
801
|
// flight starts on the free occupancy slot (see REALTIME_WORKER_OCCUPANCY_CAP).
|
|
858
802
|
this.active = null;
|
|
859
803
|
this._handoffActive = true;
|
|
860
|
-
this.handoffOwner = entry;
|
|
861
804
|
this.handoffDeferredAt = this.now();
|
|
862
805
|
this.handoffAdmitted = false;
|
|
863
806
|
this.handoffBacklog = null;
|
|
@@ -887,7 +830,6 @@ export class CooperativePassScheduler {
|
|
|
887
830
|
}
|
|
888
831
|
finally {
|
|
889
832
|
this._handoffActive = false;
|
|
890
|
-
this.handoffOwner = null;
|
|
891
833
|
this.handoffDeferredAt = null;
|
|
892
834
|
this.handoffBacklog = null;
|
|
893
835
|
if (!this.stopped)
|
|
@@ -1715,13 +1657,6 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
1715
1657
|
// executing, a coordinator realtime task must not take the normal fast-path
|
|
1716
1658
|
// lock carve-out: it has no bounded chore lease to prove independence.
|
|
1717
1659
|
let coordinatorWholeMutationChores = 0;
|
|
1718
|
-
// Each coordinator chore runs inside this context so the scheduler entry it
|
|
1719
|
-
// submits carries its kind; blocker telemetry reads it from the holding entry.
|
|
1720
|
-
const coordinatorChoreKind = new AsyncLocalStorage();
|
|
1721
|
-
const operationGateBlockerRecorder = (telemetry) => telemetry
|
|
1722
|
-
? (blocker) => telemetry.recordOperationGateBlocker(realtimeBlockerLabel(blocker))
|
|
1723
|
-
: undefined;
|
|
1724
|
-
const coordinatorTelemetry = new WeakMap();
|
|
1725
1660
|
let operationLockUsers = 0;
|
|
1726
1661
|
let resolveNoOperationLockUsers = null;
|
|
1727
1662
|
const acquireOperationLockUser = () => {
|
|
@@ -2063,12 +1998,12 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2063
1998
|
const resolveStoppedQueue = () => {
|
|
2064
1999
|
passScheduler.stop();
|
|
2065
2000
|
};
|
|
2066
|
-
const runGuardedTask = (task, lane = "slow", workClass = "chore", allowFastRealtimeOvertake = false, signal, resourceCap = false, allowConcurrentHandoff = false, transferDirection, transferSizeClass = "unknown"
|
|
2001
|
+
const runGuardedTask = (task, lane = "slow", workClass = "chore", allowFastRealtimeOvertake = false, signal, resourceCap = false, allowConcurrentHandoff = false, transferDirection, transferSizeClass = "unknown") => {
|
|
2067
2002
|
const allowFlaggedRealtimeHandoff = allowConcurrentHandoffForGuardedWork(workClass, allowConcurrentHandoff);
|
|
2068
2003
|
// Lanes still choose the pass execution profile, but no longer decide
|
|
2069
2004
|
// chore ownership. Realtime normally waits for a chore hand-off; the
|
|
2070
2005
|
// watcher fast path explicitly opts into its established scoped exception.
|
|
2071
|
-
return passScheduler.submit(task, workClass, lane, allowFastRealtimeOvertake, signal, resourceCap, allowFlaggedRealtimeHandoff, transferDirection, transferSizeClass
|
|
2006
|
+
return passScheduler.submit(task, workClass, lane, allowFastRealtimeOvertake, signal, resourceCap, allowFlaggedRealtimeHandoff, transferDirection, transferSizeClass);
|
|
2072
2007
|
};
|
|
2073
2008
|
const runGuarded = (passArgvForRun, prepare, lane = "slow", workClass = "chore", allowFastRealtimeOvertake = false, signal, resourceCap = false, telemetry, allowConcurrentHandoff = false, receiverSignal) => {
|
|
2074
2009
|
telemetry?.mark("operationGate");
|
|
@@ -2079,7 +2014,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2079
2014
|
telemetry?.mark("appendLock");
|
|
2080
2015
|
telemetry?.setOccupancy(passScheduler.activeRealtimeWorkerCount);
|
|
2081
2016
|
return runPassWithLock(passArgvForRun, prepare, lane, workClass, workClass === "chore" ? context.checkpoint : undefined, telemetry, context.signal, receiverSignal);
|
|
2082
|
-
}, lane, workClass, allowFastRealtimeOvertake, admissionSignal, resourceCap, allowConcurrentHandoff, telemetry?.direction, telemetry?.sizeClass
|
|
2017
|
+
}, lane, workClass, allowFastRealtimeOvertake, admissionSignal, resourceCap, allowConcurrentHandoff, telemetry?.direction, telemetry?.sizeClass);
|
|
2083
2018
|
};
|
|
2084
2019
|
/*
|
|
2085
2020
|
* Area storage and the parallel coordinator default to AUTO. AUTO turns
|
|
@@ -2106,9 +2041,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2106
2041
|
if (slice.work.class === "chore" && execution.wholeMutation)
|
|
2107
2042
|
coordinatorWholeMutationChores += 1;
|
|
2108
2043
|
try {
|
|
2109
|
-
execution.result = slice
|
|
2110
|
-
? await coordinatorChoreKind.run(slice.work.kind, () => execution.run(slice))
|
|
2111
|
-
: await execution.run(slice);
|
|
2044
|
+
execution.result = await execution.run(slice);
|
|
2112
2045
|
}
|
|
2113
2046
|
finally {
|
|
2114
2047
|
if (slice.work.class === "chore" && execution.wholeMutation)
|
|
@@ -2139,11 +2072,6 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2139
2072
|
// therefore remains behind the runner's guarded operation queue until
|
|
2140
2073
|
// those executors can provide concrete scopes.
|
|
2141
2074
|
planChorePaths: () => [],
|
|
2142
|
-
onRealtimeAdmissionBlocked: (queued, heldBy) => {
|
|
2143
|
-
coordinatorTelemetry.get(queued)?.recordAdmissionBlocker(heldBy.class === "realtime"
|
|
2144
|
-
? `realtime:${heldBy.lane === "fast" ? "fast" : "slow"}`
|
|
2145
|
-
: realtimeBlockerLabel({ workClass: "chore", lane: "slow", choreKind: heldBy.kind }));
|
|
2146
|
-
},
|
|
2147
2075
|
});
|
|
2148
2076
|
let coordinator = parallelCoordinatorEnabled ? createCoordinator() : null;
|
|
2149
2077
|
const runCoordinatorWork = async (work, task, options = {}) => {
|
|
@@ -2163,8 +2091,6 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
2163
2091
|
};
|
|
2164
2092
|
}
|
|
2165
2093
|
telemetry?.mark("worker");
|
|
2166
|
-
if (telemetry)
|
|
2167
|
-
coordinatorTelemetry.set(work, telemetry);
|
|
2168
2094
|
const execution = {
|
|
2169
2095
|
run: async (slice) => {
|
|
2170
2096
|
telemetry?.mark("conflict");
|
|
@@ -4213,10 +4139,10 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
4213
4139
|
let outcome;
|
|
4214
4140
|
try {
|
|
4215
4141
|
if (parallelCoordinatorEnabled) {
|
|
4216
|
-
const execution = await runRealtimePass("wake", "pull", [], "slow", async (_slice,
|
|
4142
|
+
const execution = await runRealtimePass("wake", "pull", [], "slow", async (_slice, _telemetry, coordinatorFenced) => runGuardedTask(() => runTaskWithLock(async () => {
|
|
4217
4143
|
await drain();
|
|
4218
4144
|
return 0;
|
|
4219
|
-
}, "realtime"), "slow", "realtime", false, undefined, false, coordinatorFenced
|
|
4145
|
+
}, "realtime"), "slow", "realtime", false, undefined, false, coordinatorFenced));
|
|
4220
4146
|
outcome = execution.accepted ? execution.result : 1;
|
|
4221
4147
|
}
|
|
4222
4148
|
else {
|