Skip to content

fix(agent/agentscripts): track cron run and wait for cron stop #10388

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

Merged
merged 3 commits into from
Oct 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
handle err
  • Loading branch information
mafredri committed Oct 23, 2023
commit be9a07b2acd6580b782199b7430c41f5f15e2780
5 changes: 4 additions & 1 deletion agent/agentscripts/agentscripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,12 @@ func (r *Runner) StartCron() {
// cron.Start() and cron.Stop() does not guarantee that the cron goroutine
// has exited by the time the `cron.Stop()` context returns, so we need to
// track it manually.
r.trackCommandGoroutine(func() {
err := r.trackCommandGoroutine(func() {
r.cron.Run()
})
if err != nil {
r.Logger.Warn(context.Background(), "start cron", slog.Error(err))
}
}

// Execute runs a set of scripts according to a filter.
Expand Down