fix: deduplicate STACKS_EVENT_OBSERVER endpoint already registered in config file#7204
Open
vwinee21 wants to merge 1 commit into
Open
fix: deduplicate STACKS_EVENT_OBSERVER endpoint already registered in config file#7204vwinee21 wants to merge 1 commit into
vwinee21 wants to merge 1 commit into
Conversation
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.
Problem
Fixes #2810
When
STACKS_EVENT_OBSERVERenv var points to the same endpoint already registered in theevents_observerTOML block, stacks-node inserts twoEventObserverConfigentries into theHashSet— one with the events_keys from TOML, and one withAnyEventfrom the env var.Because
EventObserverConfigderivesHash + Eqacross all fields (endpoint, events_keys, timeout_ms, disable_retries), two configs with the same endpoint but differentevents_keysare considered distinct — both inserted, both receive broadcasts. The API server receives every event twice, causing it to fail over time.Fix
Before inserting the env var observer, check if any existing observer already has the same endpoint. If found, emit a
warn!log and skip the insert:Notes
warn!log is emitted so operators are aware of the duplicate configuration.