Conversation
yordis
reviewed
Sep 9, 2026
Comment on lines
+64
to
65
| |> Stream.filter(&PubSub.subscribed?(event_store, &1.stream_uuid)) | ||
| |> Stream.map(&read_events(&1, state)) |
Contributor
There was a problem hiding this comment.
I would appreciate it if this were placed behind a feature flag since this affects the system level architecture, this is not a local decision.
A subscribe can appear between the filter and map, and I do not know who in the codebases I maintain understands the implications of this change.
I would rather continue letting the Subscription engine handle the optimizations you are trying to implement than use :eventstore.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Every node currently reads and deserializes each event notification before discovering that the local PubSub registry has no recipient. In a cluster with subscribers concentrated on a few nodes, this multiplies database reads and decoding work across the other nodes.
Filter notification topics before reading storage, using the existing local Registry. Exact-stream and
$allnotifications are checked separately. Persistent subscriptions still register before catching up from their durable checkpoint; acknowledgement and checkpoint handling are unchanged.The regressions cover skipped reads, unrelated/exact/
$allsubscribers, selectors and mappers, unregistering, and persistent catch-up after a skipped notification. Both fail against the original publisher and pass with the filter.Validation on Elixir 1.16.1 / OTP 26.2.5.7 with an isolated PostgreSQL 12 server:
mix test.all: passes for the default, JSONB, text-identifier and migration configurations (407 tests and 2 doctests per configuration, with the suite's normal exclusions).mix format --check-formatted,mix compile --warnings-as-errors, andmix dialyzer: pass.