-
Notifications
You must be signed in to change notification settings - Fork 5
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 queued channel failure logic #436
Merged
Merged
Conversation
This file contains 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
commit: |
denis-rossati
previously approved these changes
Oct 17, 2024
Fryuni
requested changes
Oct 17, 2024
Fryuni
reviewed
Oct 17, 2024
Fryuni
approved these changes
Oct 17, 2024
Code Climate has analyzed commit 077619e and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 99.9% (0.0% change). View more on Code Climate. |
Fryuni
approved these changes
Oct 17, 2024
9 tasks
9 tasks
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.
Summary
The current implementation of the queued channel doesn't handle failures, and that went unnoticed before because the old event tracker service just dropped invalid events. Now, with the new service, the SDK has to do the dropping. This change caused downstream channels to report errors to the upstream channel, which wasn't happening before—so this issue surfaced.
Right now, when a message fails, the queue just stops processing until a new event comes in. Since errors aren't being handled, failed messages don't get dequeued, which causes the queue to get stuck and eventually fill up.
This PR fixes that by making sure failed messages are dequeued so the next ones can still be tried.
Also, when the channel was reinitialized, you had to manually call the flush to reenqueue the messages. If you tried to send a message, it would fail and tell you to flush first. Now, it’s been refactored, so if there are pending messages, they’ll automatically get reenqueued before the new message is sent.
Lastly, this PR also makes "Connection deliberately closed" errors retryable since it's part of the regular lifecycle. For example, if the SDK is unplugged while messages are still being sent, it will retry sending them once plugged back in.
Checklist