feat: change reconnection timer implementation unix time -> cpu clock time#3182
Merged
sfeilmeier merged 2 commits intoOpenEMS:developfrom Aug 23, 2025
Conversation
Codecov ReportAttention: Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #3182 +/- ##
=============================================
+ Coverage 58.84% 58.84% +0.01%
Complexity 173 173
=============================================
Files 2619 2619
Lines 113026 113026
Branches 8317 8317
=============================================
+ Hits 66499 66502 +3
+ Misses 44038 44033 -5
- Partials 2489 2491 +2 🚀 New features to boost your workflow:
|
sfeilmeier
reviewed
Aug 3, 2025
Contributor
sfeilmeier
left a comment
There was a problem hiding this comment.
Looks good. Sorry, I did not find time to review earlier. Now it has to be rebased to current develop.
| this.parent = parent; | ||
| this.config = config; | ||
| this.minWaitSecondsBetweenRetries = new Random().nextInt(config.maxWaitSeconds()) + config.minWaitSeconds(); | ||
| this.lastTry = System.nanoTime() - this.minWaitSecondsBetweenRetries * 1_000_000_000L; |
Contributor
There was a problem hiding this comment.
1_000_000_000L seems arbitrary. Can we not set lastTry to zero instead?
… time. Currently reconnection timer use unix timestamp and it feed from system. But this time is not motonic increasing, So there is possibility of time go away to far future, in this case the timer doesn't work correctly. Especially, In case of use RTC and edge is in booting time, If System recoginize wrong time, Sometime edge set wrong timer period and wait forever. // Actually We face this problem recently. This change provice to use monotonic timer it based on cpu clock to resolve ↑ problem. Cpu clock has no external dependencies and It suitable reconnection timer use. Co-author: @cvabc, claude code, chatgpt codex, github copilot
09b9741 to
817cad1
Compare
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.
Currently reconnection timer use unix timestamp and it feed from system. But this time is not monotonic increasing, So there is possibility of time go away to far future, in this case the timer doesn't work correctly. Especially, In case of use RTC and edge is in booting time, If System recoginize wrong time, Sometime edge set wrong timer period and wait forever. // Actually We face this problem recently.
This change provice to use monotonic timer it based on cpu clock to resolve ↑ problem.
Cpu clock has no external dependencies and It suitable reconnection timer use.
Co-author: @cvabc, claude code, chatgpt codex, github copilot