@remnic/core 10.0.53 → 10.0.54
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/access-cli.js +2 -2
- package/dist/{chunk-CA6X37OB.js → chunk-2GU6XS4L.js} +3 -3
- package/dist/chunk-2GU6XS4L.js.map +1 -0
- package/dist/{chunk-H4DWSOBQ.js → chunk-PVG7TCUG.js} +31 -14
- package/dist/chunk-PVG7TCUG.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/orchestration/maintenance.d.ts +1 -1
- package/dist/orchestration/maintenance.d.ts.map +1 -1
- package/dist/orchestration/maintenance.js +1 -1
- package/dist/orchestration/qmd-maintenance-completion.d.ts +9 -4
- package/dist/orchestration/qmd-maintenance-completion.d.ts.map +1 -1
- package/dist/orchestrator.js +2 -2
- package/package.json +2 -2
- package/src/orchestration/maintenance.test.ts +139 -0
- package/src/orchestration/maintenance.ts +17 -8
- package/src/orchestration/qmd-maintenance-completion.ts +21 -9
- package/src/orchestrator.ts +1 -1
- package/dist/chunk-CA6X37OB.js.map +0 -1
- package/dist/chunk-H4DWSOBQ.js.map +0 -1
|
@@ -423,19 +423,30 @@ async function drainPendingLifecycleAppendsForPath(memoryDir) {
|
|
|
423
423
|
// src/orchestration/qmd-maintenance-completion.ts
|
|
424
424
|
var QmdMaintenanceCompletion = class {
|
|
425
425
|
waiters = [];
|
|
426
|
-
/**
|
|
427
|
-
|
|
428
|
-
|
|
426
|
+
/**
|
|
427
|
+
* Resolves true when a pass that started after this call completed successfully. With a
|
|
428
|
+
* `namespace` the request is served as soon as a pass ran that namespace, whatever else it skipped.
|
|
429
|
+
*/
|
|
430
|
+
wait(namespace) {
|
|
431
|
+
return new Promise((resolve) => this.waiters.push({ resolve, namespace }));
|
|
429
432
|
}
|
|
430
433
|
/**
|
|
431
434
|
* A pass is starting: take every waiter it will serve and return their settle function.
|
|
432
|
-
* `
|
|
435
|
+
* `ran` lists the namespaces a namespace-aware pass ran (absent when namespaces are disabled:
|
|
436
|
+
* one corpus is maintained and the pass outcome applies to every waiter); `defer` keeps the
|
|
437
|
+
* waiters it did not serve waiting for a later pass (a pass that covered only part of the selection).
|
|
433
438
|
*/
|
|
434
439
|
claim() {
|
|
435
440
|
const claimed = this.waiters.splice(0);
|
|
436
|
-
return (served, defer = false) => {
|
|
437
|
-
|
|
438
|
-
|
|
441
|
+
return (served, defer = false, ran) => {
|
|
442
|
+
const requeue = [];
|
|
443
|
+
for (const waiter of claimed) {
|
|
444
|
+
const own = waiter.namespace !== void 0 && ran !== void 0 ? ran.has(waiter.namespace) : served;
|
|
445
|
+
if (own) waiter.resolve(true);
|
|
446
|
+
else if (defer) requeue.push(waiter);
|
|
447
|
+
else waiter.resolve(false);
|
|
448
|
+
}
|
|
449
|
+
this.waiters.unshift(...requeue);
|
|
439
450
|
};
|
|
440
451
|
}
|
|
441
452
|
/** The scheduler stopped: nothing will serve the waiters. */
|
|
@@ -2335,9 +2346,9 @@ var MaintenanceScheduler = class {
|
|
|
2335
2346
|
* unavailable or maintenance off), the pass failed, or dispose() abandoned it,
|
|
2336
2347
|
* so a caller that must not lose the re-index keeps owing it.
|
|
2337
2348
|
*/
|
|
2338
|
-
requestQmdMaintenanceCompletion() {
|
|
2349
|
+
requestQmdMaintenanceCompletion(namespace) {
|
|
2339
2350
|
if (this.disposed || !this.requestQmdMaintenance()) return Promise.resolve(false);
|
|
2340
|
-
return this.qmdCompletion.wait();
|
|
2351
|
+
return this.qmdCompletion.wait(namespace);
|
|
2341
2352
|
}
|
|
2342
2353
|
/**
|
|
2343
2354
|
* Public entrypoint for tool-driven QMD maintenance requests.
|
|
@@ -2370,6 +2381,7 @@ var MaintenanceScheduler = class {
|
|
|
2370
2381
|
const settle = this.qmdCompletion.claim();
|
|
2371
2382
|
let served = false;
|
|
2372
2383
|
let deferred = false;
|
|
2384
|
+
let ranNamespaces;
|
|
2373
2385
|
try {
|
|
2374
2386
|
if (resolveNamespaceCapabilities(this.deps.config).namespaces) {
|
|
2375
2387
|
const plan = await this.namespaceMaintenancePlan("qmd");
|
|
@@ -2436,15 +2448,20 @@ var MaintenanceScheduler = class {
|
|
|
2436
2448
|
}
|
|
2437
2449
|
);
|
|
2438
2450
|
const covered = this.qmdCoveredNamespaces;
|
|
2451
|
+
const ran = /* @__PURE__ */ new Set();
|
|
2452
|
+
ranNamespaces = ran;
|
|
2439
2453
|
const before = covered.size;
|
|
2440
2454
|
for (const status of summary.statuses) {
|
|
2441
|
-
if (status.state
|
|
2455
|
+
if (status.state !== "ran") continue;
|
|
2456
|
+
covered.add(status.namespace);
|
|
2457
|
+
ran.add(status.namespace);
|
|
2442
2458
|
}
|
|
2443
2459
|
const uncovered = summary.statuses.some(
|
|
2444
2460
|
(status) => status.state === "skipped" && (status.reason === "budget_exhausted" || status.reason === "lock_held") && !covered.has(status.namespace)
|
|
2445
2461
|
);
|
|
2446
|
-
|
|
2447
|
-
|
|
2462
|
+
const catalogReadFailed = plan.skipped.some((skip) => skip.reason === "catalog_read_failed");
|
|
2463
|
+
served = summary.ran > 0 && summary.failed === 0 && !uncovered && !catalogReadFailed;
|
|
2464
|
+
deferred = !served && summary.failed === 0 && !catalogReadFailed && covered.size > before && !this.disposed;
|
|
2448
2465
|
} else {
|
|
2449
2466
|
const qmd = this.deps.getQmd();
|
|
2450
2467
|
if (qmd.updateCompleted) {
|
|
@@ -2470,7 +2487,7 @@ var MaintenanceScheduler = class {
|
|
|
2470
2487
|
}
|
|
2471
2488
|
}
|
|
2472
2489
|
} finally {
|
|
2473
|
-
settle(served, deferred);
|
|
2490
|
+
settle(served, deferred, ranNamespaces);
|
|
2474
2491
|
if (!deferred) this.qmdCoveredNamespaces.clear();
|
|
2475
2492
|
this.qmdMaintenanceInFlight = false;
|
|
2476
2493
|
if (deferred) this.qmdMaintenancePending = true;
|
|
@@ -2857,4 +2874,4 @@ export {
|
|
|
2857
2874
|
ActivitySyncScheduler,
|
|
2858
2875
|
MaintenanceScheduler
|
|
2859
2876
|
};
|
|
2860
|
-
//# sourceMappingURL=chunk-
|
|
2877
|
+
//# sourceMappingURL=chunk-PVG7TCUG.js.map
|