Repository navigation
Improve: spread widget polling so widgets do not fetch in lockstep - #53
Merged
Merged
Conversation
The widget toolbox scheduled each repeat on an exact interval, so widgets opened together kept fetching on the same tick. The dashboard shell had solved this for its own polls with a local helper. Move that helper into ui/js/jitter.js and use it in both. The first fetch stays immediate: that one is the widget's content.
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.
Summary
ui/js/jitter.js, holding the ±15% spread as one dependency-free helper, and register both path forms intsconfig.frontend.json.poll(), leaving the first fetch immediate._jitwith the shared helper, so the rule has one definition.NaNdelay thatsetTimeoutturns into a busy loop.poll()indocs/widgets.md.Testing
All green, apart from the Docker build smoke test, which needs a local Docker daemon. Added 5 tests: the jitter bounds under stubbed randomness and across 500 draws, unusable intervals, and a poll test that captures the scheduled delay to confirm the repeat is spread while the first fetch waits for nothing.
Checklist