Commit a3456975 authored by Kyle Clarke's avatar Kyle Clarke 💬

Passing runner instance to anon function to ensure correct instance being altered.

parent b29f7eb7
Pipeline #4941213 passed with stage
in 29 seconds
......@@ -113,10 +113,11 @@ func (r *runner) Stopped() bool {
func do(r *runner) {
safety := uint64(0)
e := time.NewTicker(r.job.Every)
defer func() {
// On close set the completed time for this job runner.
defer func(r *runner) {
// On close set the completed time for this job runner and call stop to be safe and mitigate leaks.
r.completed = time.Now().UTC()
}()
r.Stop()
}(r)
for range e.C {
// Check if the stop flag been set against the runner task.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment