fix: limit minimum time for stored positions to minTimeOffset (18 hours ago)#49
Merged
fix: limit minimum time for stored positions to minTimeOffset (18 hours ago)#49
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the position tracking system to prevent processing logs older than a configurable minimum time threshold. It renames variables for clarity and adds runtime validation to clamp stored positions to a minimum time boundary.
Key Changes:
- Renames
defaultTimetominTimeanddefaultTimeBeforetominTimeOffsetfor clearer semantics - Increases the minimum time offset from 12 hours to 18 hours in the past
- Adds validation in
Load()to returnminTimewhen stored times are older than the threshold
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…rs ago) - Add check in Load() to return minTime when stored time is older - Rename defaultTime to minTime and defaultTimeBefore to minTimeOffset for clarity
8e33212 to
c3684b5
Compare
Contributor
Code Metrics Report
Details | | main (b18830b) | #49 (54bc9f6) | +/- |
|---------------------|----------------|---------------|-------|
+ | Coverage | 5.6% | 5.8% | +0.2% |
| Files | 10 | 10 | 0 |
| Lines | 405 | 407 | +2 |
+ | Covered | 23 | 24 | +1 |
+ | Code to Test Ratio | 1:0.1 | 1:0.1 | +0.0 |
| Code | 939 | 942 | +3 |
+ | Test | 102 | 108 | +6 |
| Test Execution Time | 10s | 10s | 0s |Code coverage of files in pull request scope (30.2% → 30.7%)
Reported by octocov |
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.
This pull request updates the logic for handling minimum time offsets in the
Posstruct, making the minimum allowable time more flexible and robust. The main changes involve renaming variables for clarity, extending the minimum time offset, and ensuring that loaded times do not fall below this minimum.Improvements to time handling and struct clarity:
-12 * time.Hourto-18 * time.Hourand renamed the variable fromdefaultTimeBeforetominTimeOffsetfor clarity.Posstruct and its constructors to useminTimeinstead ofdefaultTime, reflecting the new minimum time logic.Robustness in time loading:
Loadmethod to ensure that any loaded time earlier thanminTimeis replaced withminTime, preventing outdated timestamps from being used.