fix(eventsourcingdb): separate handler retries from observer reconnects#56
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the EventSourcingDB event observer so that handler failures are retried in-place (without tearing down the observe stream), while connection/stream failures use separate reconnect retry options. It also deprecates retryOptions as an alias for connection retries and updates tests + docs to cover the new behavior.
Changes:
- Split observer retry configuration into
connectionRetryOptions(stream reconnects) andhandlerRetryOptions(in-place handler retries), with optionalonHandlerErrorafter handler retry exhaustion. - Export and use
observeWithRetryfor an awaitable observation loop;initEventObserverremains the background/non-blocking entry point. - Extend integration tests and update docs/examples/README to describe the new retry model and the deprecated option.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/eventsourcingdb/src/lib/integration.test.ts | Adds coverage for handler in-place retries, poison event skipping, and connection retry exhaustion/reconnect behavior. |
| packages/eventsourcingdb/src/lib/eventObserver.ts | Implements separate connection vs handler retry paths; adds onHandlerError; exports observeWithRetry. |
| packages/eventsourcingdb/src/lib/client.ts | Updates setup JSDoc example to use connectionRetryOptions + handlerRetryOptions. |
| packages/eventsourcingdb/README.md | Updates user-facing documentation for split retry behavior and deprecates retryOptions. |
| examples/eventsourcing-demo/src/eventsourcingdb.ts | Adds an example observer demonstrating handler retry + onHandlerError usage. |
| docs/guide/eventsourcingdb/event-observer.md | Updates the guide to document the new options and behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Handler failures no longer tear down the observe stream. Retry them
in-place, skip after exhaustion (optional onHandlerError), and keep
connectionRetryOptions for stream reconnects. Deprecate retryOptions
as an alias for connection retries.