querysub 0.506.0 → 0.507.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "querysub",
3
- "version": "0.506.0",
3
+ "version": "0.507.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -1,4 +1,4 @@
1
- import { delay, runInfinitePoll } from "socket-function/src/batching";
1
+ import { batchFunction, delay, runInfinitePoll } from "socket-function/src/batching";
2
2
  import { cache } from "socket-function/src/caching";
3
3
  import { blue, magenta, yellow } from "socket-function/src/formatting/logColors";
4
4
  import { timeInHour, timeInSecond } from "socket-function/src/misc";
@@ -492,20 +492,16 @@ export class PathFunctionRunner {
492
492
  );
493
493
  };
494
494
 
495
- private pendingTickWaiters: { runAtTime: Time; resolve: () => void; }[] | undefined;
496
- private async letIOClear(runAtTime: Time): Promise<void> {
497
- if (!this.pendingTickWaiters) {
498
- let waiters: { runAtTime: Time; resolve: () => void; }[] = [];
499
- this.pendingTickWaiters = waiters;
500
- void delay(100).then(() => {
501
- this.pendingTickWaiters = undefined;
502
- waiters.sort((a, b) => compareTime(a.runAtTime, b.runAtTime));
503
- for (let w of waiters) w.resolve();
504
- });
495
+ private letIOClearBatch = batchFunction(
496
+ { delay: 1, throttleWindow: 5000 },
497
+ (waiters: { runAtTime: Time; resolve: () => void; }[]) => {
498
+ waiters.sort((a, b) => compareTime(a.runAtTime, b.runAtTime));
499
+ for (let w of waiters) w.resolve();
505
500
  }
506
- let waiters = this.pendingTickWaiters;
501
+ );
502
+ private async letIOClear(runAtTime: Time): Promise<void> {
507
503
  await new Promise<void>(resolve => {
508
- waiters.push({ runAtTime, resolve });
504
+ void this.letIOClearBatch({ runAtTime, resolve });
509
505
  });
510
506
  }
511
507
 
@@ -211,7 +211,7 @@ export function exposeTicketService() {
211
211
  async function getTicketServiceNode(): Promise<string> {
212
212
  let controllerNodeId = await getControllerNodeId(TicketServiceBase, !isPublic());
213
213
  if (!controllerNodeId) {
214
- throw new Error(`Could not find node exposing controller TicketServiceBase. Is \`yarn tickets\` running?`);
214
+ throw new Error(`Could not find node exposing controller TicketServiceBase. Is the \`yarn error-watch\` service running?`);
215
215
  }
216
216
  return controllerNodeId;
217
217
  }