Repeaters, v.2: Sleep 0.2s if all locked #35686
Closed
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.
Technical Summary
This past weekend I was (over?)thinking about how PR #35033 loops over repeaters, and I came up with two alternatives. This "version 2" is the first. (See PR #35687 for version 3.)
Comparison
The approach used in PR #35033 is relatively simple, and fast at sending repeat records of repeaters that are already being processed. But new repeat records of repeaters that are not being processed can take up to 5 minutes to be discovered and processed.
In comparison, this version, version 2, checks every minute for repeaters with repeat records ready to be sent (and if it is busy processing repeaters, it will find new repeat records sooner than that).
If all repeaters are locked, it will wait 200ms for a repeater to finish processing, and then query for repeaters again. This approach is simpler than the approach taken in version 3, but it can result in queries returning all repeaters locked. It is this unnecessary churn on Postgres that prompted version 3.
Here is what version 2 looks like in Datadog:
Review commits together 🏢
Feature Flag
PROCESS_REPEATERS
Safety Assurance
Safety story
Automated test coverage
Tests included
Rollback instructions
Labels & Review