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
Proper enrichFromCache panic fix and go-whisper upgrade #486
Proper enrichFromCache panic fix and go-whisper upgrade #486
Conversation
deniszh
commented
Aug 11, 2022
- proper fix for enrichFromCache panic. Extending array with 0, tried NaN but it's immediately failing during marshalling, obviously.
- upgrading go-whisper to include buffer merge fix.
Not sure why linter doing this... I see 0 issues running it locally:
|
hi, @deniszh in case the comment didn't reach you, the changes in go-whisper might have failed some of the unit test cases. more here: go-graphite/go-whisper#35 (comment) |
for _, item := range cacheData { | ||
ts := int64(item.Timestamp) - int64(item.Timestamp)%r.StepTime | ||
if ts < r.StartTime || ts >= r.StopTime { | ||
continue | ||
} | ||
pointsFetchedFromCache++ | ||
index := (ts - r.StartTime) / r.StepTime | ||
// TODO: log.debug such cases | ||
if index >= 0 && index < int64(len(r.Values)) { |
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.
How about keeping the defensive code just in case?
This way, a bug or invalid data in the cache (like ts
older than r.StartTime
) will not cause a panic.
But I'm not well aware of the code as a whole. So your call.
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.
Well, it will not hurt, so let's keep it.
@bom-d-van : Thanks, it's fixed now! |