querysub 0.60.0 → 0.61.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.60.0",
3
+ "version": "0.61.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",
@@ -8,13 +8,22 @@ function createHookFunction<Fnc extends (...args: any[]) => void>(debugName: str
8
8
  let queuedCalls = [] as Parameters<Fnc>[];
9
9
  let declaration: Fnc | undefined;
10
10
  setImmediate(() => {
11
+ if (!declaration) {
12
+ setTimeout(flushQueued, 1000);
13
+ return;
14
+ }
15
+ flushQueued();
16
+ });
17
+ function flushQueued() {
11
18
  if (!declaration) {
12
19
  throw new Error(`Hook function ${debugName} not declared`);
13
20
  }
14
- for (let call of queuedCalls) {
21
+ let queued = queuedCalls;
22
+ queuedCalls = [];
23
+ for (let call of queued) {
15
24
  declaration(...call);
16
25
  }
17
- });
26
+ }
18
27
  function fnc(...args: Parameters<Fnc>): void {
19
28
  if (declaration) {
20
29
  declaration(...args);
package/src/server.ts CHANGED
@@ -40,7 +40,7 @@ async function main() {
40
40
 
41
41
  Error.stackTraceLimit = 20;
42
42
 
43
- SocketFunction.logMessages = true;
43
+ //SocketFunction.logMessages = true;
44
44
 
45
45
  // ClientWatcher.DEBUG_READS = true;
46
46
  // ClientWatcher.DEBUG_WRITES = true;