aboutsummaryrefslogtreecommitdiffstats
path: root/src/worker.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2022-11-26 13:42:19 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2022-11-26 13:42:19 +0000
commit92e51ab7a970cbd2f7e69c24dfd8c76e2a3204aa (patch)
tree00cbc07bfd84275ef31fb2624dc0ea2ed4afd223 /src/worker.c
parentef1f86ea1255e0afb05595aabbc2e8e6697fbb52 (diff)
downloadrspamd-92e51ab7a970cbd2f7e69c24dfd8c76e2a3204aa.tar.gz
rspamd-92e51ab7a970cbd2f7e69c24dfd8c76e2a3204aa.zip
[Minor] Deduplicate code
Diffstat (limited to 'src/worker.c')
-rw-r--r--src/worker.c29
1 files changed, 1 insertions, 28 deletions
diff --git a/src/worker.c b/src/worker.c
index 10f7c076c..ac8f87af5 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -509,34 +509,7 @@ start_worker (struct rspamd_worker *worker)
rspamd_worker_init_scanner (worker, ctx->event_loop, ctx->resolver,
&ctx->lang_det);
- if (worker->index == 0) {
- /* If there are no controllers, then pretend that we are a controller */
- gboolean controller_seen = FALSE;
- GList *cur;
-
- cur = worker->srv->cfg->workers;
-
- while (cur) {
- struct rspamd_worker_conf *cf;
-
- cf = (struct rspamd_worker_conf *)cur->data;
- if (cf->type == g_quark_from_static_string ("controller")) {
- if (cf->enabled && cf->count >= 0) {
- controller_seen = TRUE;
- break;
- }
- }
-
- cur = g_list_next (cur);
- }
-
- if (!controller_seen) {
- msg_info_ctx ("no controller workers defined, execute "
- "controller periodics in this worker");
- worker->flags |= RSPAMD_WORKER_CONTROLLER;
- is_controller = TRUE;
- }
- }
+ is_controller = rspamd_worker_check_controller_presence (worker);
if (is_controller) {
rspamd_worker_init_controller (worker, NULL);