-
Notifications
You must be signed in to change notification settings - Fork 2
Release the check-in anchor when the check-in never reached the backend #71
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the backend receives and processes a check-in but returns a 5xx response,
Upstream.Pipepropagates that status and this condition treats it as non-delivery. The anchor is removed, so an immediate retry is forwarded and can duplicate a check-in the backend already received or credited.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accurate, and intentional. A backend that recorded the check-in and then answered 5xx does lose its anchor here.
The cost of that is one extra upstream call: the next check-in forwards early, and the backend's own per-account spacing refuses it as too close. No double credit, because this gate is not what decides credit.
The cost of the other choice is an account losing a check-in and its streak, silently, because the gate answers 201. That asymmetry is the whole reason this endpoint is being fixed, so every boundary case here resolves toward forwarding. It is written up as an invariant at the top of CheckinGate rather than left as an accident.
There is also no signal that would let the gate do better. A 5xx cannot be split into "recorded then failed" and "never recorded" from this side, and even a clean 2xx does not mean credited: the backend's verifier decides that asynchronously, after the response.