diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-11-06 14:38:16 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-11-06 14:38:16 +0000 |
commit | 87a2bd10978bd09e864f76f073de8484698c8345 (patch) | |
tree | 4a70b39066a3d39607084ade0bd477cfdfc65a69 /src/libserver/worker_util.c | |
parent | 1ca69a5c735892c97864d92dce2334e68ca22a98 (diff) | |
download | rspamd-87a2bd10978bd09e864f76f073de8484698c8345.tar.gz rspamd-87a2bd10978bd09e864f76f073de8484698c8345.zip |
[Feature] Shutdown timeout is now associated with task timeout
Diffstat (limited to 'src/libserver/worker_util.c')
-rw-r--r-- | src/libserver/worker_util.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c index c527cecfc..ddf74136d 100644 --- a/src/libserver/worker_util.c +++ b/src/libserver/worker_util.c @@ -174,6 +174,10 @@ rspamd_worker_usr2_handler (struct rspamd_worker_signal_handler *sigh, void *arg /* Do not accept new connections, preparing to end worker's process */ if (!sigh->worker->wanna_die) { static ev_timer shutdown_ev; + ev_tstamp shutdown_ts; + + shutdown_ts = MAX (SOFT_SHUTDOWN_TIME, + sigh->worker->srv->cfg->task_timeout * 2.0); rspamd_worker_ignore_signal (sigh); sigh->worker->wanna_die = TRUE; @@ -182,10 +186,10 @@ rspamd_worker_usr2_handler (struct rspamd_worker_signal_handler *sigh, void *arg sigh->worker->srv->server_pool->tag.tagname, sigh->worker->srv->server_pool->tag.uid, G_STRFUNC, - "worker's shutdown is pending in %d sec", - SOFT_SHUTDOWN_TIME); + "worker's shutdown is pending in %.2f sec", + shutdown_ts); ev_timer_init (&shutdown_ev, rspamd_worker_on_delayed_shutdown, - SOFT_SHUTDOWN_TIME, 0.0); + shutdown_ts, 0.0); ev_timer_start (sigh->event_loop, &shutdown_ev); rspamd_worker_stop_accept (sigh->worker); } |