@cosmicdrift/kumiko-framework 0.122.1 → 0.122.2
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": "@cosmicdrift/kumiko-framework",
|
|
3
|
-
"version": "0.122.
|
|
3
|
+
"version": "0.122.2",
|
|
4
4
|
"description": "Framework core — engine, pipeline, API, DB, and every other bit that makes Kumiko go.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
"zod": "^4.4.3"
|
|
190
190
|
},
|
|
191
191
|
"devDependencies": {
|
|
192
|
-
"@cosmicdrift/kumiko-dispatcher-live": "0.122.
|
|
192
|
+
"@cosmicdrift/kumiko-dispatcher-live": "0.122.2",
|
|
193
193
|
"bun-types": "^1.3.13",
|
|
194
194
|
"pino-pretty": "^13.1.3"
|
|
195
195
|
},
|
|
@@ -159,10 +159,20 @@ describe("event-dispatcher — happy path", () => {
|
|
|
159
159
|
await stack.eventDispatcher?.runOnce();
|
|
160
160
|
expect(captureA).toHaveLength(1);
|
|
161
161
|
|
|
162
|
+
const stateBefore = await getConsumerState(stack.db, qnA);
|
|
163
|
+
|
|
162
164
|
const second = await stack.eventDispatcher?.runOnce();
|
|
163
165
|
expect(second?.byConsumer[qnA]).toEqual({ processed: 0, failed: 0 });
|
|
164
166
|
// Still only one — consumer correctly saw "nothing new past my cursor".
|
|
165
167
|
expect(captureA).toHaveLength(1);
|
|
168
|
+
|
|
169
|
+
// No pending events means no write at all — an idle pass must not touch
|
|
170
|
+
// updated_at/status, otherwise every empty poll tick burns a WAL record.
|
|
171
|
+
const stateAfter = await getConsumerState(stack.db, qnA);
|
|
172
|
+
expect(stateAfter?.updatedAt.epochMilliseconds).toEqual(
|
|
173
|
+
stateBefore?.updatedAt.epochMilliseconds,
|
|
174
|
+
);
|
|
175
|
+
expect(stateAfter?.status).toBe(stateBefore?.status);
|
|
166
176
|
});
|
|
167
177
|
|
|
168
178
|
test("cursor advances only past successfully-consumed events", async () => {
|
|
@@ -524,9 +524,16 @@ export function createEventDispatcher(options: EventDispatcherOptions): EventDis
|
|
|
524
524
|
span.setAttribute("consumer.skip_reason", acquired.skip);
|
|
525
525
|
return;
|
|
526
526
|
}
|
|
527
|
-
await markProcessing(tx, consumer.name, instanceId);
|
|
528
527
|
|
|
529
528
|
const events = await fetchPendingEvents(tx, acquired.state.lastProcessedEventId, batchSize);
|
|
529
|
+
// skip: nothing to deliver — no markProcessing/persistConsumerOutcome write,
|
|
530
|
+
// so an idle consumer doesn't burn a WAL record on every poll tick.
|
|
531
|
+
if (events.length === 0) {
|
|
532
|
+
span.setAttribute("consumer.skip_reason", "no_pending_events");
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
await markProcessing(tx, consumer.name, instanceId);
|
|
536
|
+
|
|
530
537
|
const outcome = await deliverEvents(consumer, events, context, maxAttempts, acquired.state);
|
|
531
538
|
processed = outcome.processed;
|
|
532
539
|
failed = outcome.failed;
|