omp-fabric 1.18.1 → 1.18.3

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.
@@ -1566,6 +1566,7 @@ var LcmMaintenance = class {
1566
1566
  };
1567
1567
 
1568
1568
  // src/compaction/lcm-runtime.ts
1569
+ var SHUTDOWN_GRACE_MS = 500;
1569
1570
  var MAX_AUTO_REPAIR_ATTEMPTS = 5;
1570
1571
  var AUTO_REPAIR_DELAY_MS = 3e4;
1571
1572
  var AUTO_REPAIR_CLEAR_MS = 18e5;
@@ -2375,13 +2376,27 @@ var LcmRuntime = class {
2375
2376
  raw(sessionId) {
2376
2377
  return this.ledger.readRaw(this.projectKey, sessionId);
2377
2378
  }
2379
+ /** Waits for writes, then gives aborted maintenance a bounded grace before detaching the ledger close. */
2378
2380
  async shutdown() {
2379
2381
  if (this.closed) return;
2380
2382
  this.closed = true;
2381
2383
  this.abort.abort();
2382
2384
  await this.writePending.catch(() => void 0);
2383
- await this.maintenancePending.catch(() => void 0);
2384
- this.ledger.close();
2385
+ const pending = this.maintenancePending.catch(() => void 0);
2386
+ const grace = new Promise((resolve) => {
2387
+ const timer = setTimeout(() => resolve(false), SHUTDOWN_GRACE_MS);
2388
+ timer.unref?.();
2389
+ });
2390
+ if (await Promise.race([pending.then(() => true), grace])) {
2391
+ this.ledger.close();
2392
+ return;
2393
+ }
2394
+ void pending.then(() => {
2395
+ try {
2396
+ this.ledger.close();
2397
+ } catch {
2398
+ }
2399
+ });
2385
2400
  }
2386
2401
  };
2387
2402
  export {