@rotorsoft/act 0.34.0 → 0.35.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/README.md +27 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -74,6 +74,11 @@ const app = act().withSlice(CounterSlice).build();
|
|
|
74
74
|
- [API Reference](https://rotorsoft.github.io/act-root/docs/api/)
|
|
75
75
|
- [Examples](https://github.com/rotorsoft/act-root/tree/master/packages)
|
|
76
76
|
|
|
77
|
+
## Performance
|
|
78
|
+
|
|
79
|
+
- [PERFORMANCE.md](./PERFORMANCE.md) — historical optimizations, batched projection replay, and the **[Reaction latency](./PERFORMANCE.md#reaction-latency-act-103)** section answering "how long from `do()` to reaction firing?"
|
|
80
|
+
- [BENCH.md](../../BENCH.md) — index of every benchmark in the workspace with run commands and current numbers.
|
|
81
|
+
|
|
77
82
|
---
|
|
78
83
|
|
|
79
84
|
## Event Store
|
|
@@ -337,6 +342,28 @@ Stores **self-filter** their own commits (per-instance UUID in the payload) so t
|
|
|
337
342
|
|
|
338
343
|
`notify` is a hint, not a contract: if the store doesn't implement it, or a notification is dropped, the existing debounce/poll path still drains correctly. Build-time contract: inject the configured store via `store(adapter)` *before* `act()...build()` — wiring binds at construction.
|
|
339
344
|
|
|
345
|
+
### Reaction Priority Lanes (ACT-102)
|
|
346
|
+
|
|
347
|
+
When the worker is saturated (more lagging streams than `streamLimit` per cycle), priority biases which lagging stream gets the lease first:
|
|
348
|
+
|
|
349
|
+
```ts
|
|
350
|
+
.on("OrderConfirmed")
|
|
351
|
+
.do(sendCriticalNotification)
|
|
352
|
+
.to({ target: "notifications-out", priority: 10 }) // jumps the lagging queue
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
`claim()`'s lagging frontier orders by `priority DESC, at ASC`. Default priority is `0` — apps that don't opt in see no behavior change. **Per-stream event ordering is unchanged** — priority only biases *which streams claim() picks first*, never reorders events within a stream.
|
|
356
|
+
|
|
357
|
+
Operators can override scheduling at runtime with `app.prioritize(filter, n)`. Filter shape mirrors `query_streams` (regex on `stream`/`source`, exact-match flags, `blocked` state). Sets the priority outright, ignoring the build-time max invariant — so it can decrease too:
|
|
358
|
+
|
|
359
|
+
```ts
|
|
360
|
+
await app.prioritize({ stream: "^proj-orders$", stream_exact: false }, 10);
|
|
361
|
+
await app.prioritize({ source: "^audit-" }, -5);
|
|
362
|
+
await app.prioritize({}, 0); // reset all to default
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
Only meaningful under saturation. With `streamLimit` ≥ candidate streams every cycle, every stream gets a slot every cycle and priority never binds. See [`@rotorsoft/act-pg/PERFORMANCE.md`](../act-pg/PERFORMANCE.md) for the ~11× speedup benchmark on tied-watermark replays under heavy contention.
|
|
366
|
+
|
|
340
367
|
## Dual-Frontier Drain
|
|
341
368
|
|
|
342
369
|
In event-sourced systems, consumers often subscribe to multiple event streams that advance at different rates: some produce bursts of events, while others stay idle for long periods. New streams can also be discovered while processing events from existing streams.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rotorsoft/act",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.35.0",
|
|
5
5
|
"description": "act core library",
|
|
6
6
|
"author": "rotorsoft",
|
|
7
7
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@rotorsoft/act-patch": "^1.
|
|
38
|
+
"@rotorsoft/act-patch": "^1.2.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"zod": "^4.4.3"
|
|
@@ -44,6 +44,9 @@
|
|
|
44
44
|
"clean": "rm -rf dist",
|
|
45
45
|
"types": "tsc --build tsconfig.build.json --emitDeclarationOnly",
|
|
46
46
|
"build": "pnpm clean && tsup && pnpm types",
|
|
47
|
+
"bench:micro": "vitest bench --run",
|
|
48
|
+
"bench:scenarios": "vitest run --config vitest.bench.config.ts",
|
|
49
|
+
"bench:latency": "vitest run --config vitest.bench.config.ts bench/reaction-latency.bench.ts",
|
|
47
50
|
"bench:run": "NODE_ENV=test LOG_LEVEL=fatal tsx scripts/perf-bench.ts > perf-result.json",
|
|
48
51
|
"bench:check": "tsx scripts/perf-check.ts",
|
|
49
52
|
"bench:update": "NODE_ENV=test LOG_LEVEL=fatal tsx scripts/perf-bench.ts > perf-baseline.json",
|