@impz/testing 6.11.5 → 6.11.6

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/dist/index.js +33 -17
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -22009,7 +22009,7 @@ import { join as join48 } from "path";
22009
22009
  // packages/daemon/package.json
22010
22010
  var package_default = {
22011
22011
  name: "@impz/daemon",
22012
- version: "6.11.5",
22012
+ version: "6.11.6",
22013
22013
  private: true,
22014
22014
  description: "impd: the imp host daemon",
22015
22015
  type: "module",
@@ -53589,6 +53589,33 @@ function createTailnetAccess(config, deps, readStatus) {
53589
53589
  };
53590
53590
  }
53591
53591
 
53592
+ // packages/daemon/src/create-write-work.ts
53593
+ function createWriteWork() {
53594
+ const pending = new Set;
53595
+ const track = async (work) => {
53596
+ pending.add(work);
53597
+ try {
53598
+ await work;
53599
+ } catch (error) {
53600
+ getImpdLogger("events").warning("could not follow a database write: {error}", {
53601
+ error: getErrorMessage(error)
53602
+ });
53603
+ } finally {
53604
+ pending.delete(work);
53605
+ }
53606
+ };
53607
+ return {
53608
+ run: (work) => {
53609
+ if (work !== undefined) {
53610
+ track(work);
53611
+ }
53612
+ },
53613
+ stop: async () => {
53614
+ await Promise.allSettled(pending);
53615
+ }
53616
+ };
53617
+ }
53618
+
53592
53619
  // packages/daemon/src/identity/token.ts
53593
53620
  import { existsSync as existsSync21, readFileSync as readFileSync27, writeFileSync as writeFileSync9 } from "fs";
53594
53621
  import { join as join34 } from "path";
@@ -60270,32 +60297,21 @@ async function startImpdParts(config, boundaries, plan) {
60270
60297
  const governor = governed.governor;
60271
60298
  const identity = governed.identity;
60272
60299
  plan.imps = imps;
60273
- const writeWork = new Set;
60274
- const runWriteWork = async (work) => {
60275
- if (work === undefined) {
60276
- return;
60277
- }
60278
- writeWork.add(work);
60279
- try {
60280
- await work;
60281
- } finally {
60282
- writeWork.delete(work);
60283
- }
60284
- };
60300
+ const writeWork = createWriteWork();
60285
60301
  const unsubscribeWrites = db.log.subscribe((event) => {
60286
60302
  if (isUsageChange(event)) {
60287
60303
  diskUsage.requestRefresh();
60288
60304
  }
60289
60305
  if (isImpSetChange(event)) {
60290
- runWriteWork(proxyHolder.proxy?.syncListeners());
60291
- runWriteWork(broker.applyGrants());
60292
- runWriteWork(namesHolder.names?.trySync());
60306
+ writeWork.run(proxyHolder.proxy?.syncListeners());
60307
+ writeWork.run(broker.applyGrants());
60308
+ writeWork.run(namesHolder.names?.trySync());
60293
60309
  }
60294
60310
  });
60295
60311
  const dbWrites = {
60296
60312
  stop: async () => {
60297
60313
  unsubscribeWrites();
60298
- await Promise.allSettled(writeWork);
60314
+ await writeWork.stop();
60299
60315
  }
60300
60316
  };
60301
60317
  plan.dbWrites = dbWrites;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impz/testing",
3
- "version": "6.11.5",
3
+ "version": "6.11.6",
4
4
  "description": "A real impd on stand-ins, for Bun tests of code that drives impd through @impz/client",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -43,7 +43,7 @@
43
43
  "ts-pattern": "^5.9.2",
44
44
  "xstate": "^5.33.3",
45
45
  "zod": "^4.6.7",
46
- "@impz/client": "6.11.5"
46
+ "@impz/client": "6.11.6"
47
47
  },
48
48
  "engines": {
49
49
  "bun": ">=1.4.3"