Missing signal to jobs when receiving SIGTERM makes clean shutdown impossible
Opened this issue · 1 comments
When trying to run cron jobs with go-crond from a container, and a new deployment happens, the container receives a SIGTERM to signal the request for termination. This causes go-crond to exit immediately, while all running jobs never receive a signal. The exit of go-crond signals openshift that the container shut down, terminating the container and all still-running jobs un-cleanly.
My expectation is: when go-crond receives SIGTERM it should send all running jobs the same SIGTERM and wait for them to exit, only then should go-crond exit. This would let the jobs exit cleanly.
quick/dirty/naive fix is to use the Context returned in https://github.com/webdevops/go-crond/blob/main/runner.go#L116 and wait until it finishes with <-ctx.Done()
it does not send signals to the cron jobs, but at least it waits for them to exit before go-crond exits itself