-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Fix double fetch #35843
Fix double fetch #35843
Conversation
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
Pinging @elastic/uptime (Team:Uptime) |
return nil | ||
} | ||
|
||
p.fetched = true |
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.
@andrewvc, can we defer this assignment until the source is successfully extracted? If it fails for a transient error, as it is it will never retry
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.
I've done so, but it's unlikely to be transient as we're just unpacking a file, though I suppose a full disk could be freed (unlikely on a container however).
@andrewvc I hope you don't mind, I pushed some fixes to unit tests since I was testing locally |
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
Fixes #35646 by only unpacking project monitors once. This fixes the ever growing temp folder issue and is more efficient to boot. Previously we would call fetch on a monitor source every time it was run, but only cleanup the fetched resource once, when the monitor was unloaded. We now fetch once and cleanup once. This project also fixes the very confusing issue of two files browser/project.go and browser/source/project.go, we have renamed browser/project.go to browser/sourcejob.go which makes reasoning about this change simpler. (cherry picked from commit f7111dc)
Fixes #35646 by only unpacking project monitors once. This fixes the ever growing temp folder issue and is more efficient to boot. Previously we would call fetch on a monitor source every time it was run, but only cleanup the fetched resource once, when the monitor was unloaded. We now fetch once and cleanup once. This project also fixes the very confusing issue of two files browser/project.go and browser/source/project.go, we have renamed browser/project.go to browser/sourcejob.go which makes reasoning about this change simpler. (cherry picked from commit f7111dc) Co-authored-by: Andrew Cholakian <[email protected]>
Fixes #35646 by only unpacking project monitors once.
This fixes the ever growing temp folder issue and is more efficient to boot. Previously we would call
fetch
on a monitor source every time it was run, but only cleanup the fetched resource once, when the monitor was unloaded. We now fetch once and cleanup once.This project also fixes the very confusing issue of two files
browser/project.go
andbrowser/source/project.go
, we have renamedbrowser/project.go
tobrowser/sourcejob.go
which makes reasoning about this change simpler.Manual testing
Test with a config like this one by placing it in your
monitors.d
folder inx-pack/heartbeat
.Then, in your
heartbeat.yml
enable config reloading. Finally, test by running:You should see logs like the following:
You should then be able to editor your config in
monitors.d
, perhaps changing the schedule field, etc, forcing it to reload, and see the temp directories used by heartbeat changing, but that only one at a time exists, with the old ones being cleaned up.