diff options
-rw-r--r-- | src/libserver/cfg_file.h | 1 | ||||
-rw-r--r-- | src/libserver/worker_util.c | 1 | ||||
-rw-r--r-- | src/libutil/map.c | 4 | ||||
-rw-r--r-- | src/lua/lua_config.c | 8 |
4 files changed, 14 insertions, 0 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h index 1cf4a1faf..96a44f45e 100644 --- a/src/libserver/cfg_file.h +++ b/src/libserver/cfg_file.h @@ -493,6 +493,7 @@ struct rspamd_config { struct rspamd_config_settings_elt *setting_ids; /**< preprocessed settings ids */ struct rspamd_lang_detector *lang_det; /**< language detector */ + struct rspamd_worker *cur_worker; /**< set dynamically by each worker */ ref_entry_t ref; /**< reference counter */ }; diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c index e3927063d..aff418abe 100644 --- a/src/libserver/worker_util.c +++ b/src/libserver/worker_util.c @@ -1054,6 +1054,7 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main, close (wrk->srv_pipe[0]); rspamd_socket_nonblocking (wrk->control_pipe[1]); rspamd_socket_nonblocking (wrk->srv_pipe[1]); + rspamd_main->cfg->cur_worker = wrk; /* Execute worker */ cf->worker->worker_start_func (wrk); exit (EXIT_FAILURE); diff --git a/src/libutil/map.c b/src/libutil/map.c index 8da3c7bd4..dcdb58f35 100644 --- a/src/libutil/map.c +++ b/src/libutil/map.c @@ -974,6 +974,10 @@ rspamd_map_periodic_dtor (struct map_periodic_cbdata *periodic) rspamd_map_schedule_periodic (periodic->map, RSPAMD_SYMBOL_RESULT_NORMAL); } + else { + msg_debug_map ("stop scheduling periodics for %s; terminating state", + periodic->map->name); + } } g_free (periodic); diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index 33873d8ab..b7bddc34b 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -3186,6 +3186,14 @@ lua_periodic_callback_finish (struct thread_entry *thread, int ret) lua_pop (L, 1); /* Return value */ } + + if (periodic->cfg->cur_worker) { + if (periodic->cfg->cur_worker->state != rspamd_worker_state_running) { + /* We are terminating, no more periodics */ + plan_more = FALSE; + } + } + if (plan_more) { if (periodic->need_jitter) { timeout = rspamd_time_jitter (timeout, 0.0); |