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 */
};
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);
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);
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);