@rotorsoft/act 2.2.2 → 2.2.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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/internal/config.d.ts +2 -2
- package/dist/@types/internal/config.d.ts.map +1 -1
- package/dist/@types/internal/defer-timer.d.ts +5 -0
- package/dist/@types/internal/defer-timer.d.ts.map +1 -1
- package/dist/@types/types/reaction.d.ts +2 -2
- package/dist/adapter.cjs +3 -3
- package/dist/adapter.js +2 -2
- package/dist/{chunk-GHMCESJA.js → chunk-53JUJWPI.js} +2 -2
- package/dist/{chunk-K4FF6ZXO.cjs → chunk-62LDEIDM.cjs} +146 -64
- package/dist/chunk-62LDEIDM.cjs.map +1 -0
- package/dist/{chunk-LHSNV3VN.js → chunk-BJSOC2ZV.js} +93 -11
- package/dist/chunk-BJSOC2ZV.js.map +1 -0
- package/dist/{chunk-QITJ63HG.cjs → chunk-DAVFDMC4.cjs} +11 -11
- package/dist/{chunk-QITJ63HG.cjs.map → chunk-DAVFDMC4.cjs.map} +1 -1
- package/dist/{chunk-KAUON2M3.js → chunk-TI6QERGQ.js} +1 -1
- package/dist/{chunk-KAUON2M3.js.map → chunk-TI6QERGQ.js.map} +1 -1
- package/dist/{chunk-LA2BPKNS.cjs → chunk-ZI4NSYCD.cjs} +1 -1
- package/dist/{chunk-LA2BPKNS.cjs.map → chunk-ZI4NSYCD.cjs.map} +1 -1
- package/dist/index.cjs +464 -541
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -81
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +9 -9
- package/dist/test/index.js +3 -3
- package/dist/types/index.cjs +2 -2
- package/dist/types/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-K4FF6ZXO.cjs.map +0 -1
- package/dist/chunk-LHSNV3VN.js.map +0 -1
- /package/dist/{chunk-GHMCESJA.js.map → chunk-53JUJWPI.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
DEFAULT_LEASE_MILLIS,
|
|
7
7
|
DEFAULT_MAX_RETRIES,
|
|
8
8
|
DEFAULT_STREAM_LIMIT,
|
|
9
|
+
DeferTimer,
|
|
9
10
|
InMemoryCache,
|
|
10
11
|
InMemoryStore,
|
|
11
12
|
LruMap,
|
|
@@ -27,7 +28,7 @@ import {
|
|
|
27
28
|
store,
|
|
28
29
|
unscoped_ports,
|
|
29
30
|
validate
|
|
30
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-BJSOC2ZV.js";
|
|
31
32
|
import {
|
|
32
33
|
checkAppends,
|
|
33
34
|
checkVersion,
|
|
@@ -36,7 +37,7 @@ import {
|
|
|
36
37
|
isStreamName,
|
|
37
38
|
parseNotification,
|
|
38
39
|
seedEvent
|
|
39
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-53JUJWPI.js";
|
|
40
41
|
import {
|
|
41
42
|
ActorSchema,
|
|
42
43
|
CausationEventSchema,
|
|
@@ -66,7 +67,7 @@ import {
|
|
|
66
67
|
ZodEmpty,
|
|
67
68
|
__name,
|
|
68
69
|
sensitive
|
|
69
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-TI6QERGQ.js";
|
|
70
71
|
|
|
71
72
|
// src/signals.ts
|
|
72
73
|
process.once("SIGINT", async (arg) => {
|
|
@@ -960,84 +961,6 @@ function compute_backoff_delay(retry, opts) {
|
|
|
960
961
|
}
|
|
961
962
|
__name(compute_backoff_delay, "compute_backoff_delay");
|
|
962
963
|
|
|
963
|
-
// src/internal/defer-timer.ts
|
|
964
|
-
var MAX_TIMER_DELAY_MS = 2147483647;
|
|
965
|
-
var DeferTimer = class {
|
|
966
|
-
static {
|
|
967
|
-
__name(this, "DeferTimer");
|
|
968
|
-
}
|
|
969
|
-
_due = /* @__PURE__ */ new Map();
|
|
970
|
-
_timer;
|
|
971
|
-
_on_wake;
|
|
972
|
-
/**
|
|
973
|
-
* @param on_wake - invoked once each time the earliest due-time elapses.
|
|
974
|
-
* The consumer re-schedules for whatever is still parked.
|
|
975
|
-
*/
|
|
976
|
-
constructor(on_wake) {
|
|
977
|
-
this._on_wake = on_wake;
|
|
978
|
-
}
|
|
979
|
-
/** Number of currently parked streams. */
|
|
980
|
-
get size() {
|
|
981
|
-
return this._due.size;
|
|
982
|
-
}
|
|
983
|
-
/**
|
|
984
|
-
* Park `stream` for a re-visit at `at` (ms since epoch). A plain
|
|
985
|
-
* overwrite: the caller computes the authoritative next-visit for the
|
|
986
|
-
* stream (the drain's `handle` already reconciles a stream's reactions
|
|
987
|
-
* into one result per cycle), so there is no stale value to merge against.
|
|
988
|
-
*/
|
|
989
|
-
set(stream, at) {
|
|
990
|
-
this._due.set(stream, at);
|
|
991
|
-
}
|
|
992
|
-
/** Drop `stream` from the parked set (e.g. on a successful ack or block). */
|
|
993
|
-
delete(stream) {
|
|
994
|
-
this._due.delete(stream);
|
|
995
|
-
}
|
|
996
|
-
/**
|
|
997
|
-
* Drop every entry due at or before `before`. The drain calls it when a
|
|
998
|
-
* pass that started at `before` claimed nothing: whatever was due by then
|
|
999
|
-
* was handled elsewhere (another worker) or has no work left, so waking
|
|
1000
|
-
* for it again would spin.
|
|
1001
|
-
*/
|
|
1002
|
-
prune(before) {
|
|
1003
|
-
for (const [stream, at] of this._due)
|
|
1004
|
-
if (at <= before) this._due.delete(stream);
|
|
1005
|
-
}
|
|
1006
|
-
/**
|
|
1007
|
-
* (Re)schedule the wake timer at the earliest pending due-time. Idempotent
|
|
1008
|
-
* — collapses many parked streams into a single timer. A no-op clears any
|
|
1009
|
-
* pending timer when the map is empty.
|
|
1010
|
-
*
|
|
1011
|
-
* The timer is `unref()`-ed so pending re-visits never keep the process
|
|
1012
|
-
* alive on their own.
|
|
1013
|
-
*/
|
|
1014
|
-
schedule() {
|
|
1015
|
-
if (this._timer) clearTimeout(this._timer);
|
|
1016
|
-
if (this._due.size === 0) {
|
|
1017
|
-
this._timer = void 0;
|
|
1018
|
-
return;
|
|
1019
|
-
}
|
|
1020
|
-
let earliest = Number.POSITIVE_INFINITY;
|
|
1021
|
-
for (const t of this._due.values()) if (t < earliest) earliest = t;
|
|
1022
|
-
const delay = Math.min(
|
|
1023
|
-
Math.max(0, earliest - Date.now()),
|
|
1024
|
-
MAX_TIMER_DELAY_MS
|
|
1025
|
-
);
|
|
1026
|
-
this._timer = setTimeout(() => {
|
|
1027
|
-
this._timer = void 0;
|
|
1028
|
-
this._on_wake();
|
|
1029
|
-
}, delay);
|
|
1030
|
-
this._timer.unref();
|
|
1031
|
-
}
|
|
1032
|
-
/** Cancel any pending wake timer. Idempotent. Leaves the parked set intact. */
|
|
1033
|
-
stop() {
|
|
1034
|
-
if (this._timer) {
|
|
1035
|
-
clearTimeout(this._timer);
|
|
1036
|
-
this._timer = void 0;
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
};
|
|
1040
|
-
|
|
1041
964
|
// src/internal/drain-ratio.ts
|
|
1042
965
|
var RATIO_MIN = 0.2;
|
|
1043
966
|
var RATIO_MAX = 0.8;
|