Skip to content

Fix duplicate event subscriptions on retry - #87

Open
damilolaedwards wants to merge 1 commit into
ethpandaops:masterfrom
damilolaedwards:fix/duplicate-event-subscriptions
Open

Fix duplicate event subscriptions on retry#87
damilolaedwards wants to merge 1 commit into
ethpandaops:masterfrom
damilolaedwards:fix/duplicate-event-subscriptions

Conversation

@damilolaedwards

Copy link
Copy Markdown

Summary

subscribeToBeaconEvents subscribed topics one at a time and gave up on the first failure, leaving earlier topics subscribed. The retry loop then resubscribed the whole list every two seconds, so topics before a bad one built up duplicate live subscriptions forever (each one an independently reconnecting stream, so handlers fire once per duplicate) while topics after it never subscribed at all.

Fix tracks already-subscribed topics and skips them on retry, and logs and skips a topic that fails instead of aborting the rest of the list.

Test plan

  • Added tests in pkg/beacon/subscriptions_test.go: one with a permanently bad topic in the middle of the list confirming good topics before and after it each subscribe exactly once, one confirming the happy path returns once all topics subscribe
  • Confirmed the first test fails against the old code and passes against the fix
  • go build ./..., go vet ./..., go test -race ./... all green

subscribeToBeaconEvents subscribed topics one at a time and gave up
on the first failure, leaving earlier topics subscribed. The retry
loop then resubscribed the whole list every two seconds, so topics
before a bad one built up duplicate live subscriptions forever while
topics after it never subscribed at all. Now already-subscribed
topics are tracked and skipped on retry, and a topic that fails is
logged and skipped instead of aborting the rest of the list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant