@rotorsoft/act 1.23.23 → 1.23.24
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.map +1 -1
- package/dist/{chunk-4JK4QJIT.js → chunk-ORKHOSH2.js} +2 -23
- package/dist/{chunk-4JK4QJIT.js.map → chunk-ORKHOSH2.js.map} +1 -1
- package/dist/index.cjs +10 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -7
- package/dist/index.js.map +1 -1
- package/dist/test/index.js +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -248,27 +248,6 @@ var LruMap = class {
|
|
|
248
248
|
return this._entries.size;
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
|
-
var LruSet = class {
|
|
252
|
-
_map;
|
|
253
|
-
constructor(maxSize) {
|
|
254
|
-
this._map = new LruMap(maxSize);
|
|
255
|
-
}
|
|
256
|
-
has(value) {
|
|
257
|
-
return this._map.has(value);
|
|
258
|
-
}
|
|
259
|
-
add(value) {
|
|
260
|
-
this._map.set(value, true);
|
|
261
|
-
}
|
|
262
|
-
delete(value) {
|
|
263
|
-
return this._map.delete(value);
|
|
264
|
-
}
|
|
265
|
-
clear() {
|
|
266
|
-
this._map.clear();
|
|
267
|
-
}
|
|
268
|
-
get size() {
|
|
269
|
-
return this._map.size;
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
251
|
|
|
273
252
|
// src/adapters/in-memory-cache.ts
|
|
274
253
|
var InMemoryCache = class {
|
|
@@ -3055,6 +3034,11 @@ var CorrelateCycle = class {
|
|
|
3055
3034
|
_checkpoint = -1;
|
|
3056
3035
|
_initialized = false;
|
|
3057
3036
|
_timer = void 0;
|
|
3037
|
+
// target → the priority it was last subscribed at. A dynamic target is
|
|
3038
|
+
// re-subscribed (so the store's `GREATEST` upsert runs) only when a later
|
|
3039
|
+
// scan resolves a *higher* priority for it — the runtime `max()` invariant
|
|
3040
|
+
// (#1363). Static targets are recorded at +Infinity so a dynamic resolution
|
|
3041
|
+
// never re-opens them (their priority is owned by the build-time subscribe).
|
|
3058
3042
|
_subscribed;
|
|
3059
3043
|
_registry;
|
|
3060
3044
|
_static_targets;
|
|
@@ -3096,7 +3080,7 @@ var CorrelateCycle = class {
|
|
|
3096
3080
|
on_init_async,
|
|
3097
3081
|
cold_start_back_scan = DEFAULT_COLD_START_BACK_SCAN
|
|
3098
3082
|
}) {
|
|
3099
|
-
this._subscribed = new
|
|
3083
|
+
this._subscribed = new LruMap(max_subscribed_streams);
|
|
3100
3084
|
this._registry = registry;
|
|
3101
3085
|
this._static_targets = static_targets;
|
|
3102
3086
|
this._has_dynamic_resolvers = has_dynamic_resolvers;
|
|
@@ -3136,7 +3120,7 @@ var CorrelateCycle = class {
|
|
|
3136
3120
|
this._checkpoint = this._has_dynamic_resolvers ? Math.max(-1, watermark - this._cold_start_back_scan) : watermark;
|
|
3137
3121
|
this._on_init?.();
|
|
3138
3122
|
for (const { stream } of this._static_targets) {
|
|
3139
|
-
this._subscribed.
|
|
3123
|
+
this._subscribed.set(stream, Number.POSITIVE_INFINITY);
|
|
3140
3124
|
}
|
|
3141
3125
|
await this._on_init_async?.();
|
|
3142
3126
|
}
|
|
@@ -3160,7 +3144,7 @@ var CorrelateCycle = class {
|
|
|
3160
3144
|
for (const reaction of register.reactions.values()) {
|
|
3161
3145
|
if (typeof reaction.resolver !== "function") continue;
|
|
3162
3146
|
const resolved = reaction.resolver(event);
|
|
3163
|
-
if (resolved &&
|
|
3147
|
+
if (resolved && (resolved.priority ?? 0) > (this._subscribed.get(resolved.target) ?? Number.NEGATIVE_INFINITY)) {
|
|
3164
3148
|
const incoming_priority = resolved.priority ?? 0;
|
|
3165
3149
|
const entry = correlated.get(resolved.target) || {
|
|
3166
3150
|
source: resolved.source,
|
|
@@ -3196,8 +3180,8 @@ var CorrelateCycle = class {
|
|
|
3196
3180
|
const { subscribed } = await this._cd.subscribe(streams);
|
|
3197
3181
|
this._checkpoint = last_id;
|
|
3198
3182
|
if (subscribed) {
|
|
3199
|
-
for (const { stream } of streams) {
|
|
3200
|
-
this._subscribed.
|
|
3183
|
+
for (const { stream, priority } of streams) {
|
|
3184
|
+
this._subscribed.set(stream, priority);
|
|
3201
3185
|
}
|
|
3202
3186
|
}
|
|
3203
3187
|
return { subscribed, last_id };
|