commit 286422f: [Fix] Controller: Make save stats timer persistent

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Dec 27 18:28:07 UTC 2018


Author: Vsevolod Stakhov
Date: 2018-12-14 09:13:00 +0000
URL: https://github.com/rspamd/rspamd/commit/286422f481088ca9d82b9609bfa21b9e9fc9176d

[Fix] Controller: Make save stats timer persistent
Issue: #2680

---
 src/controller.c | 15 ++++++++-------
 1 file 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 ();


More information about the Commits mailing list