docs(core-events): clarify subscribe consumerFeature + failFast drop

Code-quality review nits: IEventBus.subscribe docstring said "debug
tag" but InMemoryEventBus actually ignores the param entirely. Also
add a comment to InMemoryEventBus.publish noting that under failFast
only the first rejection rethrows; other failures are intentionally
dropped.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-08 12:02:45 +02:00
parent 430c831743
commit 05f0b02856
2 changed files with 4 additions and 2 deletions

View File

@@ -11,8 +11,8 @@ export interface IEventBus {
/**
* Subscribe a handler. `consumerFeature` is the kebab-case name of the
* subscribing feature (e.g., "marketing-pages"). InMemoryEventBus uses it
* only as a debug tag; PayloadJobsEventBus uses it to name the fan-out task
* subscribing feature (e.g., "marketing-pages"). It is unused by
* InMemoryEventBus; PayloadJobsEventBus uses it to name the fan-out task
* slug deterministically (`__events.<event>.<consumerFeature>`).
*/
subscribe<T>(

View File

@@ -24,6 +24,8 @@ export class InMemoryEventBus implements IEventBus {
);
if (this.options.failFast) {
const failure = settled.find((s) => s.status === "rejected");
// Only the first rejection is rethrown. Other failures are intentionally
// dropped — `failFast` is a test-affordance, not a fault-tolerance design.
if (failure && failure.status === "rejected") throw failure.reason;
}
}