Fix latest time policy when cont. pivot switching due to decreasing rates #147
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.
Trying to fix #131.
In the LatestTime policy, if the current pivot and other topics are decreasing in rate such that the pivot alternates between these topics, the policy might indefinitely stop publishing.
The rationale of this PR is to implement a special check when a message is received from the current pivot topic causing it to decrease its rate and to lose the pivot status (because now another topic has the highest rate). When this happens, it is checked if the now outdated pivot activated a publication when it received its previous message while it was still the pivot. If not, this could indicate that the skipped publication was caused by the pivot-switching behavior, so we force the publication at the current step.
Using the test script shared in #131 (comment), the PR branch obtains:
instead using the current rolling branch (no publications when rates are decreasing):
@wjwwood @fujitatomoya @ahcorde this is a draft fix, looking forward to your suggestions and ideas, as you can point out possible shortcomings with this solution.