Repository navigation
Add the random delay before an available update as seconds - #74
Draft
jwrosewell wants to merge 2 commits into
Draft
jwrosewell wants to merge 2 commits into
jwrosewell wants to merge 2 commits into
Conversation
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
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.
For #72
This pull request is based on #71's branch (fix/data-update-schedule-race) because both change DataUpdateServiceDefault.java. It must be retargeted to rc if #71 merges first.
Problem
When a data file says when its next update is available, the data update service schedules the next check for that time plus a random delay of up to
MaxRandomisationSecondsseconds (default 600).applyIntervalRandomisationadded the random seconds to the interval in whatever unit it was given.getIntervalpassed seconds and multiplied by 1000, which was right.registerDataFilepassed the milliseconds until the update is available, so the random seconds were added as milliseconds and the checks spread over under 0.6 seconds instead of 10 minutes.Change
applyIntervalRandomisationis nowapplyIntervalRandomisationMillis. It takes and returns milliseconds and converts the random seconds itself.getIntervalis nowgetIntervalMillisand returns milliseconds without a second conversion. The variable passed to the scheduler isdelayMillis, and the javadoc ofgetIntervalMillisnow describes what it returns. Its second caller, the reschedule insidecheckForUpdate, already used milliseconds and is unchanged in behaviour.Verification
New test
DataUpdateService_Register_UpdateAvailableRandomDelayInSecondsregisters 50 data files whose update is available in one hour, with randomisation of 600 seconds. It checks no delay exceeds the available time by more than the maximum and that the largest exceeds it by more than one second.Release note
The random delay before checking for an available update is now spread over up to MaxRandomisationSeconds seconds, as configured.
Outstanding
Whether .NET has the same mismatch has not been checked.