check_renew() function is run whenever the nginx workers are reloaded
Executing systemctl reload openresty is resulting in the check_renew() function in autossl being run before the old workers are killed. This could be a problem if the reload has to executed quite often.
@nizar-m The check_new function is called in a timer for configured renew_check_interval, meaning new worker will wait to renew_check_interval time to actually do the renew.
This is not the new worker executing the check_new function, rather the old worker executing it, before it is stopped.
This happens only on reload. On restart, the workers are force closed.
I wonder this could be because the timer gets called prematurely on worker shutdown: https://github.com/openresty/lua-nginx-module#ngxtimerat
This is explained in the documentation for ngx.timer.at, although the premature expiry is applicable for ngx.timer.every as well.