From 3f3ab3c9a8ca8922c36720a567d417d68271ad91 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Sat, 26 Aug 2017 11:57:23 +0200 Subject: [PATCH] [Minor] Use controller for single-instance tasks --- src/plugins/lua/bayes_expiry.lua | 4 ++-- src/plugins/lua/dmarc.lua | 2 +- src/plugins/lua/metric_exporter.lua | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/lua/bayes_expiry.lua b/src/plugins/lua/bayes_expiry.lua index d7df264a1..674727e42 100644 --- a/src/plugins/lua/bayes_expiry.lua +++ b/src/plugins/lua/bayes_expiry.lua @@ -119,8 +119,8 @@ end rspamd_config:add_on_load(function (_, ev_base, worker) local processed_symbols, expire_script_sha - -- Exit unless we're the first 'normal' worker - if not (worker:get_name() == 'normal' and worker:get_index() == 0) then return end + -- Exit unless we're the first 'controller' worker + if not (worker:get_name() == 'controller' and worker:get_index() == 0) then return end -- Persist mempool variable to statefile on shutdown rspamd_config:register_finish_script(function () local stamp = pool:get_variable(VAR_NAME, 'double') diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua index 14b7804dc..b97881f9f 100644 --- a/src/plugins/lua/dmarc.lua +++ b/src/plugins/lua/dmarc.lua @@ -642,7 +642,7 @@ if opts['reporting'] == true then end rspamd_config:add_on_load(function(cfg, ev_base, worker) load_scripts(cfg, ev_base) - if not (worker:get_name() == 'normal' and worker:get_index() == 0) then return end + if not (worker:get_name() == 'controller' and worker:get_index() == 0) then return end local rresolver = rspamd_resolver.init(ev_base, rspamd_config) rspamd_config:register_finish_script(function () local stamp = pool:get_variable(VAR_NAME, 'double') diff --git a/src/plugins/lua/metric_exporter.lua b/src/plugins/lua/metric_exporter.lua index 4951e6594..d104c4b9b 100644 --- a/src/plugins/lua/metric_exporter.lua +++ b/src/plugins/lua/metric_exporter.lua @@ -169,8 +169,8 @@ end if not configure_metric_exporter() then return end rspamd_config:add_on_load(function (_, ev_base, worker) - -- Exit unless we're the first 'normal' worker - if not (worker:get_name() == 'normal' and worker:get_index() == 0) then return end + -- Exit unless we're the first 'controller' worker + if not (worker:get_name() == 'controller' and worker:get_index() == 0) then return end -- Persist mempool variable to statefile on shutdown rspamd_config:register_finish_script(function () local stamp = pool:get_variable(VAR_NAME, 'double') -- 2.39.5