refactor: replace nanosecond-based timing with atomic second counter#83
Merged
Conversation
- Replace `nowNano()` method and `created`-based nanosecond timestamps with an atomic `runtimeSeconds` counter refreshed by the Serve loop. - Update eviction and idle checks to use whole seconds instead of nanoseconds, improving performance by avoiding clock reads on hot paths. - Adjust test helpers to accept seconds-ago values directly for clarity and consistency. Signed-off-by: Johan Lindh <johan@linkdata.se>
…tion logic - Add comment explaining uint32 conversion safety for process uptime - Replace lossy uint32-based spare seconds calculation with duration comparison - Ensure minimum spare window of 1 second to match counter granularity Signed-off-by: Johan Lindh <johan@linkdata.se>
Signed-off-by: Johan Lindh <johan@linkdata.se>
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.
nowNano()method andcreated-based nanosecond timestamps with an atomicruntimeSecondscounter refreshed by the Serve loop.