-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize the way to initialize the start time of the AtomicBucketWrapArray #197
Conversation
Codecov Report
@@ Coverage Diff @@
## master #197 +/- ##
==========================================
+ Coverage 44.70% 44.80% +0.09%
==========================================
Files 80 80
Lines 4438 4464 +26
==========================================
+ Hits 1984 2000 +16
- Misses 2227 2235 +8
- Partials 227 229 +2
Continue to review full report at Codecov.
|
core/stat/base/leap_array.go
Outdated
startTime := calculateStartTime(util.CurrentTimeMillis(), bucketLengthInMs) | ||
for i := len - 1; i >= 0; i-- { | ||
interval := uint64(bucketLengthInMs * uint32(len)) | ||
arrayStartTime := now - (now % interval) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The startTime for current idx should be now - now % bucketLengthInMs
?
For example (in related test cases), sampleCount=10, bucketLength=200ms, now=1596199317921, then the oldest bucket of created data structure should be 1596199317800
843cda6
to
0489375
Compare
3c2dfea
to
da12b0c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks! |
Describe what this PR does / why we need it
Make the start time of AtomicBucketWrapArray align to standard time.
Fix the typo in NewLeapArray.
Does this pull request fix one issue?
Describe how you did it
Describe how to verify it
Special notes for reviews