()
| 453 | } |
| 454 | |
| 455 | func (r *Runner) Close() error { |
| 456 | r.closeMutex.Lock() |
| 457 | defer r.closeMutex.Unlock() |
| 458 | if r.isClosed() { |
| 459 | return nil |
| 460 | } |
| 461 | close(r.closed) |
| 462 | // Must cancel the cron ctx BEFORE stopping the cron. |
| 463 | r.cronCtxCancel() |
| 464 | <-r.cron.Stop().Done() |
| 465 | r.cmdCloseWait.Wait() |
| 466 | return nil |
| 467 | } |
| 468 | |
| 469 | func (r *Runner) trackCommandGoroutine(fn func()) error { |
| 470 | r.closeMutex.Lock() |