summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-16 11:45:52 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-16 11:45:52 +0100
commitc24681aa25efaffa4eb43ca9bdf4a7f0009082a5 (patch)
tree6298c1fa21004be19ebd306d92aa547e27b172fa
parent730437924bfc1a20519d45d60dbc5213c0a2d4ab (diff)
downloadrspamd-c24681aa25efaffa4eb43ca9bdf4a7f0009082a5.tar.gz
rspamd-c24681aa25efaffa4eb43ca9bdf4a7f0009082a5.zip
[Minor] Allow to set negative number of workers to disable some worker
-rw-r--r--src/libserver/cfg_file.h2
-rw-r--r--src/rspamd.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h
index da6ea5693..19c0c86c9 100644
--- a/src/libserver/cfg_file.h
+++ b/src/libserver/cfg_file.h
@@ -198,7 +198,7 @@ struct rspamd_worker_conf {
struct worker_s *worker; /**< pointer to worker type */
GQuark type; /**< type of worker */
struct rspamd_worker_bind_conf *bind_conf; /**< bind configuration */
- guint16 count; /**< number of workers */
+ gint16 count; /**< number of workers */
GList *listen_socks; /**< listening sockets descriptors */
guint32 rlimit_nofile; /**< max files limit */
guint32 rlimit_maxcore; /**< maximum core file size */
diff --git a/src/rspamd.c b/src/rspamd.c
index abc15ead9..c22afe861 100644
--- a/src/rspamd.c
+++ b/src/rspamd.c
@@ -508,6 +508,12 @@ spawn_worker_type (struct rspamd_main *rspamd_main, struct event_base *ev_base,
{
gint i;
+ if (cf->count < 0) {
+ msg_info_main ("skip spawning of worker %s: disabled in configuration",
+ cf->worker->name);
+
+ return;
+ }
if (cf->worker->flags & RSPAMD_WORKER_UNIQUE) {
if (cf->count > 1) {
msg_warn_main (