diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-12-14 09:13:00 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-12-14 09:13:00 +0000 |
commit | 286422f481088ca9d82b9609bfa21b9e9fc9176d (patch) | |
tree | 2ae57df1e552941bd97cfae5b6614ef1f2ece0f1 /src/controller.c | |
parent | 8939b059fbe42e5386e7c05b42212c83da9a2c1f (diff) | |
download | rspamd-286422f481088ca9d82b9609bfa21b9e9fc9176d.tar.gz rspamd-286422f481088ca9d82b9609bfa21b9e9fc9176d.zip |
[Fix] Controller: Make save stats timer persistent
Issue: #2680
Diffstat (limited to 'src/controller.c')
-rw-r--r-- | src/controller.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/controller.c b/src/controller.c index 4050ed13c..b8eface74 100644 --- a/src/controller.c +++ b/src/controller.c @@ -3914,6 +3914,14 @@ start_controller_worker (struct rspamd_worker *worker) rspamd_map_watch (worker->srv->cfg, ctx->ev_base, ctx->resolver, worker, TRUE); + + /* Schedule periodic stats saving, see #1823 */ + event_set (&ctx->save_stats_event, -1, EV_PERSIST, + rspamd_controller_stats_save_periodic, + ctx); + event_base_set (ctx->ev_base, &ctx->save_stats_event); + msec_to_tv (save_stats_interval, &stv); + evtimer_add (&ctx->save_stats_event, &stv); } else { rspamd_map_watch (worker->srv->cfg, ctx->ev_base, @@ -3922,13 +3930,6 @@ start_controller_worker (struct rspamd_worker *worker) rspamd_lua_run_postloads (ctx->cfg->lua_state, ctx->cfg, ctx->ev_base, worker); - /* Schedule periodic stats saving, see #1823 */ - evtimer_set (&ctx->save_stats_event, rspamd_controller_stats_save_periodic, - ctx); - event_base_set (ctx->ev_base, &ctx->save_stats_event); - msec_to_tv (save_stats_interval, &stv); - evtimer_add (&ctx->save_stats_event, &stv); - /* Start event loop */ event_base_loop (ctx->ev_base, 0); rspamd_worker_block_signals (); |