@rotorsoft/act 1.33.8 → 1.33.9
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/correlate-cycle.d.ts +8 -2
- package/dist/@types/internal/correlate-cycle.d.ts.map +1 -1
- package/dist/@types/internal/drain-cycle.d.ts +7 -1
- package/dist/@types/internal/drain-cycle.d.ts.map +1 -1
- package/dist/index.cjs +54 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -34,8 +34,14 @@ export declare class CorrelateCycle<TSchemaReg extends SchemaRegister<TActions>,
|
|
|
34
34
|
private readonly _key;
|
|
35
35
|
/** Local expiry of the held lease (0 = none); stale only costs a duplicate scan. */
|
|
36
36
|
private _lease_until;
|
|
37
|
-
/**
|
|
38
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Armed while `_raised` (bumped by a commit or notification) is ahead of
|
|
39
|
+
* `_lowered` (the raise count the last short page saw). Starts armed.
|
|
40
|
+
*/
|
|
41
|
+
private _raised;
|
|
42
|
+
private _lowered;
|
|
43
|
+
/** Counts releases, so a lease reply that lands after one is dropped. */
|
|
44
|
+
private _releases;
|
|
39
45
|
private _init_promise;
|
|
40
46
|
private readonly _dynamic_subscriptions;
|
|
41
47
|
private readonly _static_subscriptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"correlate-cycle.d.ts","sourceRoot":"","sources":["../../../src/internal/correlate-cycle.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAEV,KAAK,EACL,QAAQ,EAER,cAAc,EACd,OAAO,EAGR,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAsC/C,6EAA6E;AAC7E,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,MAAM,EAA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,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC,CAwLD;IAED;;;;OAIG;YACW,OAAO;IAmCrB,2EAA2E;IACrE,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAgBzC;CACF"}
|
|
@@ -57,7 +57,13 @@ export type DrainControllerDeps<TEvents extends Schemas, TActions extends Schema
|
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
59
|
export declare class DrainController<TEvents extends Schemas, TActions extends Schemas, TSchemaReg extends SchemaRegister<TActions>> {
|
|
60
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Armed while `_raised` is ahead of `_lowered` (the raise count the last
|
|
62
|
+
* empty claim saw), so a claim never lowers over a raise that landed
|
|
63
|
+
* during it.
|
|
64
|
+
*/
|
|
65
|
+
private _raised;
|
|
66
|
+
private _lowered;
|
|
61
67
|
private _ratio;
|
|
62
68
|
/**
|
|
63
69
|
* Local wake at the earliest parked (backoff or defer) visit, or at the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drain-cycle.d.ts","sourceRoot":"","sources":["../../../src/internal/drain-cycle.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,KAAK,EACL,YAAY,EAEZ,KAAK,EACL,MAAM,EACN,eAAe,EACf,eAAe,EACf,QAAQ,EAER,cAAc,EACd,OAAO,EACR,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAQ3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAK/C,mEAAmE;AACnE,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE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AAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAwF/D;CACF"}
|
package/dist/index.cjs
CHANGED
|
@@ -1162,21 +1162,27 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1162
1162
|
|
|
1163
1163
|
/** Local expiry of the held lease (0 = none); stale only costs a duplicate scan. */
|
|
1164
1164
|
__init6() {this._lease_until = 0}
|
|
1165
|
-
/**
|
|
1166
|
-
|
|
1165
|
+
/**
|
|
1166
|
+
* Armed while `_raised` (bumped by a commit or notification) is ahead of
|
|
1167
|
+
* `_lowered` (the raise count the last short page saw). Starts armed.
|
|
1168
|
+
*/
|
|
1169
|
+
__init7() {this._raised = 1}
|
|
1170
|
+
__init8() {this._lowered = 0}
|
|
1171
|
+
/** Counts releases, so a lease reply that lands after one is dropped. */
|
|
1172
|
+
__init9() {this._releases = 0}
|
|
1167
1173
|
|
|
1168
1174
|
// Bounded by `maxSubscribedStreams`; static records live apart so eviction
|
|
1169
1175
|
// never drops their +Infinity floor.
|
|
1170
1176
|
|
|
1171
|
-
|
|
1172
|
-
|
|
1177
|
+
__init10() {this._static_subscriptions = /* @__PURE__ */ new Map()}
|
|
1178
|
+
__init11() {this._patterns = new (0, _chunkO6QIJQRNcjs.LruMap)(PATTERN_CACHE_SIZE)}
|
|
1173
1179
|
|
|
1174
1180
|
|
|
1175
1181
|
|
|
1176
1182
|
|
|
1177
1183
|
|
|
1178
1184
|
/** Report-once keys; per instance because `internal/` holds no module state. */
|
|
1179
|
-
|
|
1185
|
+
__init12() {this._reported = /* @__PURE__ */ new Set()}
|
|
1180
1186
|
constructor({
|
|
1181
1187
|
registry,
|
|
1182
1188
|
static_targets,
|
|
@@ -1185,7 +1191,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1185
1191
|
declared_lanes,
|
|
1186
1192
|
shard,
|
|
1187
1193
|
on_init
|
|
1188
|
-
}) {;_class3.prototype.__init3.call(this);_class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);_class3.prototype.__init8.call(this);_class3.prototype.__init9.call(this);_class3.prototype.__init10.call(this);
|
|
1194
|
+
}) {;_class3.prototype.__init3.call(this);_class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);_class3.prototype.__init8.call(this);_class3.prototype.__init9.call(this);_class3.prototype.__init10.call(this);_class3.prototype.__init11.call(this);_class3.prototype.__init12.call(this);
|
|
1189
1195
|
this._key = shard ? `${registry_key(registry.events)}:${[...shard].sort().join(",")}` : registry_key(registry.events);
|
|
1190
1196
|
this._dynamic_subscriptions = new (0, _chunkO6QIJQRNcjs.LruMap)(max_subscribed_streams);
|
|
1191
1197
|
this._registry = registry;
|
|
@@ -1199,7 +1205,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1199
1205
|
}
|
|
1200
1206
|
/** A commit (local or remote) may have produced uncorrelated events. */
|
|
1201
1207
|
arm() {
|
|
1202
|
-
this.
|
|
1208
|
+
this._raised++;
|
|
1203
1209
|
}
|
|
1204
1210
|
async init() {
|
|
1205
1211
|
if (this._initialized) return;
|
|
@@ -1233,7 +1239,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1233
1239
|
this._checkpoint = -1;
|
|
1234
1240
|
this._dynamic_subscriptions.clear();
|
|
1235
1241
|
this._static_subscriptions.clear();
|
|
1236
|
-
this.
|
|
1242
|
+
this._raised++;
|
|
1237
1243
|
}
|
|
1238
1244
|
/** Forget dynamic targets whose rows a full close deleted, so they re-subscribe. */
|
|
1239
1245
|
forget_subscribed(streams) {
|
|
@@ -1253,22 +1259,26 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1253
1259
|
/** Scan past the checkpoint, subscribe new targets and raise their work marks. */
|
|
1254
1260
|
async correlate(query = { after: -1, limit: 10 }, lease = false) {
|
|
1255
1261
|
await this.init();
|
|
1256
|
-
if (
|
|
1262
|
+
if (this._raised === this._lowered)
|
|
1257
1263
|
return {
|
|
1258
1264
|
subscribed: 0,
|
|
1259
1265
|
last_id: this._checkpoint,
|
|
1260
1266
|
marked: 0,
|
|
1261
1267
|
scanned: false
|
|
1262
1268
|
};
|
|
1269
|
+
const raised = this._raised;
|
|
1263
1270
|
const now = Date.now();
|
|
1264
1271
|
if (lease && now >= this._lease_until - CORRELATION_LEASE_MS / 2) {
|
|
1272
|
+
const releases = this._releases;
|
|
1265
1273
|
const { correlating } = await this._cd.subscribe([], void 0, {
|
|
1266
1274
|
key: this._key,
|
|
1267
1275
|
by: this._by,
|
|
1268
1276
|
millis: CORRELATION_LEASE_MS
|
|
1269
1277
|
});
|
|
1270
|
-
|
|
1271
|
-
if (
|
|
1278
|
+
const released = this._releases !== releases;
|
|
1279
|
+
if (!released)
|
|
1280
|
+
this._lease_until = correlating ? now + CORRELATION_LEASE_MS : 0;
|
|
1281
|
+
if (correlating === false || released)
|
|
1272
1282
|
return {
|
|
1273
1283
|
subscribed: 0,
|
|
1274
1284
|
last_id: this._checkpoint,
|
|
@@ -1389,7 +1399,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1389
1399
|
return { subscribed, last_id, marked, scanned: true };
|
|
1390
1400
|
}
|
|
1391
1401
|
this._checkpoint = last_id;
|
|
1392
|
-
|
|
1402
|
+
if (!stopped && found !== query.limit) this._lowered = raised;
|
|
1393
1403
|
return { subscribed: 0, last_id, marked: 0, scanned: true };
|
|
1394
1404
|
}
|
|
1395
1405
|
/**
|
|
@@ -1435,6 +1445,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1435
1445
|
async release_correlation() {
|
|
1436
1446
|
try {
|
|
1437
1447
|
this._lease_until = 0;
|
|
1448
|
+
this._releases++;
|
|
1438
1449
|
await this._cd.subscribe([], void 0, {
|
|
1439
1450
|
key: this._key,
|
|
1440
1451
|
by: this._by,
|
|
@@ -1503,14 +1514,14 @@ function compute_backoff_delay(retry, opts) {
|
|
|
1503
1514
|
// src/internal/defer-timer.ts
|
|
1504
1515
|
var MAX_TIMER_DELAY_MS = 2147483647;
|
|
1505
1516
|
var DeferTimer = (_class4 = class {
|
|
1506
|
-
|
|
1517
|
+
__init13() {this._due = /* @__PURE__ */ new Map()}
|
|
1507
1518
|
|
|
1508
1519
|
|
|
1509
1520
|
/**
|
|
1510
1521
|
* @param on_wake - invoked once each time the earliest due-time elapses.
|
|
1511
1522
|
* The consumer re-schedules for whatever is still parked.
|
|
1512
1523
|
*/
|
|
1513
|
-
constructor(on_wake) {;_class4.prototype.
|
|
1524
|
+
constructor(on_wake) {;_class4.prototype.__init13.call(this);
|
|
1514
1525
|
this._on_wake = on_wake;
|
|
1515
1526
|
}
|
|
1516
1527
|
/** Number of currently parked streams. */
|
|
@@ -2348,8 +2359,14 @@ var EMPTY_DRAIN = {
|
|
|
2348
2359
|
};
|
|
2349
2360
|
var RETRY = "";
|
|
2350
2361
|
var DrainController = (_class5 = class {
|
|
2351
|
-
|
|
2352
|
-
|
|
2362
|
+
/**
|
|
2363
|
+
* Armed while `_raised` is ahead of `_lowered` (the raise count the last
|
|
2364
|
+
* empty claim saw), so a claim never lowers over a raise that landed
|
|
2365
|
+
* during it.
|
|
2366
|
+
*/
|
|
2367
|
+
__init14() {this._raised = 0}
|
|
2368
|
+
__init15() {this._lowered = 0}
|
|
2369
|
+
__init16() {this._ratio = 0.5}
|
|
2353
2370
|
/**
|
|
2354
2371
|
* Local wake at the earliest parked (backoff or defer) visit, or at the
|
|
2355
2372
|
* lease expiry after a failed pass (the {@link RETRY} key); the schedule
|
|
@@ -2357,24 +2374,24 @@ var DrainController = (_class5 = class {
|
|
|
2357
2374
|
* drains until a pass leases nothing or the controller stops, and an entry
|
|
2358
2375
|
* stays until handled or until a later pass claims nothing.
|
|
2359
2376
|
*/
|
|
2360
|
-
|
|
2361
|
-
this.
|
|
2377
|
+
__init17() {this._defer = new DeferTimer(() => {
|
|
2378
|
+
this.arm();
|
|
2362
2379
|
void this._deps.run_scoped(async () => {
|
|
2363
2380
|
while ((await this.drain()).leased.length > 0) ;
|
|
2364
2381
|
});
|
|
2365
2382
|
})}
|
|
2366
2383
|
|
|
2367
|
-
|
|
2368
|
-
|
|
2384
|
+
__init18() {this._misrouted = /* @__PURE__ */ new Set()}
|
|
2385
|
+
__init19() {this._stopped = false}
|
|
2369
2386
|
/** Never rejects; graceful shutdown waits on it. */
|
|
2370
2387
|
|
|
2371
2388
|
|
|
2372
2389
|
|
|
2373
|
-
constructor(deps) {;_class5.prototype.
|
|
2390
|
+
constructor(deps) {;_class5.prototype.__init14.call(this);_class5.prototype.__init15.call(this);_class5.prototype.__init16.call(this);_class5.prototype.__init17.call(this);_class5.prototype.__init18.call(this);_class5.prototype.__init19.call(this);
|
|
2374
2391
|
this._deps = deps;
|
|
2375
2392
|
}
|
|
2376
2393
|
arm() {
|
|
2377
|
-
this.
|
|
2394
|
+
this._raised++;
|
|
2378
2395
|
}
|
|
2379
2396
|
/** Cold start: re-seed a persisted `deferred_at` into the local wake. */
|
|
2380
2397
|
seed_defer(stream, at) {
|
|
@@ -2382,7 +2399,7 @@ var DrainController = (_class5 = class {
|
|
|
2382
2399
|
this._defer.schedule();
|
|
2383
2400
|
}
|
|
2384
2401
|
get armed() {
|
|
2385
|
-
return this.
|
|
2402
|
+
return this._raised !== this._lowered;
|
|
2386
2403
|
}
|
|
2387
2404
|
get inflight() {
|
|
2388
2405
|
return this._inflight;
|
|
@@ -2399,7 +2416,7 @@ var DrainController = (_class5 = class {
|
|
|
2399
2416
|
if (this._worker || this._stopped) return;
|
|
2400
2417
|
const run = this._deps.run_scoped;
|
|
2401
2418
|
const tick = async () => {
|
|
2402
|
-
if (this.
|
|
2419
|
+
if (this.armed) await run(() => this.drain());
|
|
2403
2420
|
if (this._stopped) return;
|
|
2404
2421
|
this._worker = setTimeout(tick, cycleMs);
|
|
2405
2422
|
this._worker.unref();
|
|
@@ -2416,7 +2433,7 @@ var DrainController = (_class5 = class {
|
|
|
2416
2433
|
this._defer.stop();
|
|
2417
2434
|
}
|
|
2418
2435
|
async drain(options = {}) {
|
|
2419
|
-
if (!this.
|
|
2436
|
+
if (!this.armed || this._stopped || this._inflight)
|
|
2420
2437
|
return EMPTY_DRAIN;
|
|
2421
2438
|
const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
|
|
2422
2439
|
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkO6QIJQRNcjs.DEFAULT_STREAM_LIMIT));
|
|
@@ -2431,6 +2448,7 @@ var DrainController = (_class5 = class {
|
|
|
2431
2448
|
const lagging = Math.ceil(streamLimit * this._ratio);
|
|
2432
2449
|
const leading = streamLimit - lagging;
|
|
2433
2450
|
const started = Date.now();
|
|
2451
|
+
const raised = this._raised;
|
|
2434
2452
|
const cycle = await run_drain_cycle(this._deps, {
|
|
2435
2453
|
lagging,
|
|
2436
2454
|
leading,
|
|
@@ -2442,7 +2460,7 @@ var DrainController = (_class5 = class {
|
|
|
2442
2460
|
if (!cycle) {
|
|
2443
2461
|
this._defer.prune(started);
|
|
2444
2462
|
this._deps.breaker.passed();
|
|
2445
|
-
this.
|
|
2463
|
+
this._lowered = raised;
|
|
2446
2464
|
return EMPTY_DRAIN;
|
|
2447
2465
|
}
|
|
2448
2466
|
const { leased, fetched, handled, acked, blocked, closeable } = cycle;
|
|
@@ -2787,24 +2805,24 @@ function build_handle_batch(logger) {
|
|
|
2787
2805
|
|
|
2788
2806
|
// src/internal/settle.ts
|
|
2789
2807
|
var SettleLoop = (_class6 = class {
|
|
2790
|
-
|
|
2808
|
+
__init20() {this._timer = void 0}
|
|
2791
2809
|
/**
|
|
2792
2810
|
* The cycle in flight, set while one runs. Shutdown waits for it
|
|
2793
2811
|
* (`stop()` cancels scheduling only). Never rejects.
|
|
2794
2812
|
*/
|
|
2795
2813
|
|
|
2796
2814
|
/** A wake-up arrived while a cycle ran: run one more pass after it. */
|
|
2797
|
-
|
|
2815
|
+
__init21() {this._pending = false}
|
|
2798
2816
|
/** The last caller's options, used by the next pass. */
|
|
2799
|
-
|
|
2817
|
+
__init22() {this._next = void 0}
|
|
2800
2818
|
/** When the scheduled pass fires (epoch ms). */
|
|
2801
|
-
|
|
2819
|
+
__init23() {this._due = 0}
|
|
2802
2820
|
/** Set at shutdown: nothing schedules again. */
|
|
2803
|
-
|
|
2821
|
+
__init24() {this._stopped = false}
|
|
2804
2822
|
|
|
2805
2823
|
/** Debounce window applied when the caller doesn't override via `SettleOptions.debounceMs`. */
|
|
2806
2824
|
|
|
2807
|
-
constructor(deps, default_debounce_ms) {;_class6.prototype.
|
|
2825
|
+
constructor(deps, default_debounce_ms) {;_class6.prototype.__init20.call(this);_class6.prototype.__init21.call(this);_class6.prototype.__init22.call(this);_class6.prototype.__init23.call(this);_class6.prototype.__init24.call(this);
|
|
2808
2826
|
this._deps = deps;
|
|
2809
2827
|
this._default_debounce_ms = default_debounce_ms;
|
|
2810
2828
|
}
|
|
@@ -2908,7 +2926,7 @@ function validate_only_lanes(options, lanes) {
|
|
|
2908
2926
|
);
|
|
2909
2927
|
}
|
|
2910
2928
|
var Act = (_class7 = class {
|
|
2911
|
-
|
|
2929
|
+
__init25() {this._emitter = new (0, _events2.default)()}
|
|
2912
2930
|
|
|
2913
2931
|
|
|
2914
2932
|
|
|
@@ -2984,14 +3002,14 @@ var Act = (_class7 = class {
|
|
|
2984
3002
|
/** Lanes to arm per event; `"all"` when a dynamic resolver hides the lane. */
|
|
2985
3003
|
|
|
2986
3004
|
|
|
2987
|
-
|
|
3005
|
+
__init26() {this._logger = _chunkO6QIJQRNcjs.log.call(void 0, )}
|
|
2988
3006
|
/** This Act's ports: its own bag, or the singleton adapters. */
|
|
2989
3007
|
|
|
2990
3008
|
/** Runs a body so internal `store()`/`cache()` calls resolve to `_ports`. */
|
|
2991
3009
|
|
|
2992
3010
|
|
|
2993
3011
|
|
|
2994
|
-
|
|
3012
|
+
__init27() {this._close_lock = new CloseLock()}
|
|
2995
3013
|
/** Every lane a controller can exist for: `"default"` plus each declared one. */
|
|
2996
3014
|
|
|
2997
3015
|
/** Drain lanes declared via `.withLane(...)`. Implicit default not included. */
|
|
@@ -2999,7 +3017,7 @@ var Act = (_class7 = class {
|
|
|
2999
3017
|
return this._lanes;
|
|
3000
3018
|
}
|
|
3001
3019
|
/** Use the {@link act} builder rather than constructing directly. */
|
|
3002
|
-
constructor(registry, states = /* @__PURE__ */ new Map(), batch_handlers = /* @__PURE__ */ new Map(), options = {}, lanes = [], patch_fn = bare_patch) {;_class7.prototype.
|
|
3020
|
+
constructor(registry, states = /* @__PURE__ */ new Map(), batch_handlers = /* @__PURE__ */ new Map(), options = {}, lanes = [], patch_fn = bare_patch) {;_class7.prototype.__init25.call(this);_class7.prototype.__init26.call(this);_class7.prototype.__init27.call(this);
|
|
3003
3021
|
this.registry = registry;
|
|
3004
3022
|
this._states = states;
|
|
3005
3023
|
this._batch_handlers = batch_handlers;
|