Skip to content

fix: keep notifying remaining listeners when one raises - #410

Open
alexcastgonz (pcbeingused333) wants to merge 1 commit into
optimizely:masterfrom
pcbeingused333:fix/listener-isolation-c2419
Open

alexcastgonz (pcbeingused333) wants to merge 1 commit into
optimizely:masterfrom
pcbeingused333:fix/listener-isolation-c2419

Conversation

@pcbeingused333

Copy link
Copy Markdown

Summary

  • NotificationCenter#send_notifications: when a listener raises, log the error and keep notifying the remaining listeners instead of returning from the method.

The rescue inside the each block did return nil after logging, which exits send_notifications entirely. One faulty listener (e.g. an analytics integration hooked to ACTIVATE/DECISION) therefore silently prevented every listener registered after it for that notification type from being called. The method still returns nil, so its contract is unchanged.

Test plan

  • Added a spec in spec/notification_center_spec.rb: two listeners on the same type, the first raises; the second must still be called and the error logged. It fails on master (second listener never called) and passes with this change.
  • bundle exec rspec spec/notification_center_spec.rb: 32 examples, 0 failures.

Issues

  • No existing issue; small bug fix found while reading the notification code.

This change was prepared with the assistance of an AI coding assistant (Claude Code).

🤖 Generated with Claude Code

send_notifications returned from the loop after logging a failing callback, so every listener registered after it was skipped. Log the error and continue; the method still returns nil.

This branch has not been deployed

No deployments
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