@impz/testing 4.2.3 → 4.2.5

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 +18 -5
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -21862,7 +21862,7 @@ import { join as join46 } from "path";
21862
21862
  // packages/daemon/package.json
21863
21863
  var package_default = {
21864
21864
  name: "@impz/daemon",
21865
- version: "4.2.3",
21865
+ version: "4.2.5",
21866
21866
  private: true,
21867
21867
  description: "impd: the imp host daemon",
21868
21868
  type: "module",
@@ -50104,6 +50104,7 @@ function createDiskUsageCache(deps) {
50104
50104
  usage: new Map,
50105
50105
  running: null,
50106
50106
  cancelRefresh: null,
50107
+ lateDueAtMs: null,
50107
50108
  isStopped: false
50108
50109
  };
50109
50110
  const readUsagePass = async () => {
@@ -50145,16 +50146,28 @@ function createDiskUsageCache(deps) {
50145
50146
  await runOnePass();
50146
50147
  }
50147
50148
  };
50149
+ const startRefreshTimer = (durationMs) => {
50150
+ state.cancelRefresh = startTimer(() => {
50151
+ const lateDueAtMs = state.lateDueAtMs;
50152
+ state.cancelRefresh = null;
50153
+ state.lateDueAtMs = null;
50154
+ runAfterCurrent();
50155
+ if (lateDueAtMs !== null) {
50156
+ startRefreshTimer(Math.max(0, lateDueAtMs - now().getTime()));
50157
+ }
50158
+ }, durationMs);
50159
+ };
50148
50160
  return {
50149
50161
  runPass: runOnePass,
50150
50162
  requestRefresh: () => {
50151
50163
  if (state.isStopped) {
50152
50164
  return;
50153
50165
  }
50154
- state.cancelRefresh ??= startTimer(() => {
50155
- state.cancelRefresh = null;
50156
- runAfterCurrent();
50157
- }, refreshDelayMs);
50166
+ if (state.cancelRefresh === null) {
50167
+ startRefreshTimer(refreshDelayMs);
50168
+ } else {
50169
+ state.lateDueAtMs = now().getTime() + refreshDelayMs;
50170
+ }
50158
50171
  },
50159
50172
  read: (impId) => state.usage.get(impId),
50160
50173
  readExclusiveTotal: () => [...state.usage.values()].reduce((total, usage) => total + usage.exclusiveBytes, 0),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impz/testing",
3
- "version": "4.2.3",
3
+ "version": "4.2.5",
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": {
@@ -48,7 +48,7 @@
48
48
  "ts-pattern": "^5.9.0",
49
49
  "xstate": "^5.33.2",
50
50
  "zod": "^4.6.7",
51
- "@impz/client": "4.2.3"
51
+ "@impz/client": "4.2.5"
52
52
  },
53
53
  "engines": {
54
54
  "bun": ">=1.4.3"