Skip to content

booking event fan-out lets one side effect block the rest #34

Description

@Hqzdev

Problem

Booking event fan-out is not isolated. One failed side effect can prevent later side effects from running, even when they are independent.

Evidence

  • packages/api/src/shared/events/booking-events.ts:32 emits all registered handlers through Promise.all and rejects the whole emit when any handler rejects.
  • packages/api/src/shared/events/register-booking-event-handlers.ts:20 registers a booking-created handler that performs multiple side effects sequentially.
  • packages/api/src/shared/events/register-booking-event-handlers.ts:23 awaits calendar sync enqueue before reminder enqueue.
  • packages/api/src/shared/events/register-booking-event-handlers.ts:30 only enqueues the reminder after calendar sync succeeds.
  • packages/api/src/shared/events/register-booking-event-handlers.ts:35 and :46 have the same pattern for cancellation/update fan-out.

Impact

A temporary calendar queue failure can skip booking reminders. A WebSocket broadcast failure can prevent queue jobs from being created. This creates partial side effects with no DLQ or retry record for the skipped work.

Expected Fix

Make event side effects independent and observable:

  • run fan-out tasks with Promise.allSettled or separate handlers;
  • log each failed side effect with event name, booking id, and dependency name;
  • send retryable side effects to a queue/DLQ instead of skipping them;
  • add tests that one failing side effect does not stop the others.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bookingBooking service or booking domainbugSomething isn't workingreliabilityReliability and failure-mode hardening

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions