Fix boot time not returning stat file value - #1655
Conversation
add missing return statement for boot time value retrieved from stat file. Also move current time fetch to be closer to where the "time since boot file" is read
There was a problem hiding this comment.
This PR means "the value of useStatFile is not being used" and that seems correct. It only starts being used from the second time onward when caching is enabled. Indeed, now that you mention it... thank you!
The line for currentTime follows the principle of "defining it close to where it is used," but you might be right that it should be moved closer as there are a few steps in between.
So could you fix the golangci-lint ? After that, I will merge.
|
golangci-lint said something about the file not being EDIT: Nevermind, found the problem :) |
|
Great. Thanks a lot! |
When
BootTimeWithContextis called while cache is disabled, the value retrieved from reading the stat file isn't used. Also, I moved the call totime.Now()closer to where theuptimestat is read, to reduce the time between them. This still isn't perfect.