Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Duplicated notifications #159

Merged
merged 31 commits into from
Dec 1, 2022

Conversation

Lokideos
Copy link
Collaborator

@Lokideos Lokideos commented Nov 12, 2022

If several instances use the same circuit breaker for connection to third-party service, they may fire duplicated notifications if the connection is unstable.
This PR aims to fix it by introducing notification locks to allow only one notification of the same type to fire across service instances. It will not work if services do not share the data state between them (e.g., if they use the Memory data store type and run instances in separate processes/on separate machines).


Fixes #125
Fixes #116

@Lokideos Lokideos marked this pull request as ready for review November 13, 2022 10:56
@bolshakov bolshakov self-requested a review November 14, 2022 15:53
lib/stoplight/light/runnable.rb Outdated Show resolved Hide resolved
lib/stoplight/data_store/redis.rb Outdated Show resolved Hide resolved
lib/stoplight/data_store/memory.rb Outdated Show resolved Hide resolved
@Lokideos
Copy link
Collaborator Author

Lokideos commented Nov 29, 2022

@bolshakov I changed the locking mechanism, and I think it's ready for review.

@bolshakov bolshakov force-pushed the fix-duplicate-notifications branch 2 times, most recently from 37dd262 to adcb55e Compare November 30, 2022 00:22
@bolshakov bolshakov merged commit e459d46 into bolshakov:master Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notifications are flaky in prod (multi worker/server) environment
2 participants