]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Allow to set negative number of workers to disable some worker
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 16 Apr 2018 10:45:52 +0000 (11:45 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 16 Apr 2018 10:45:52 +0000 (11:45 +0100)
src/libserver/cfg_file.h
src/rspamd.c

index da6ea56936eb622cb1e12543fcf1d57c4a9ec0a7..19c0c86c91e47f9ca0b9cb2bc8328b6e03da9b2f 100644 (file)
@@ -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                                                             */
index abc15ead9d145d4f9aabed2f2079af003b49bf5a..c22afe861d930cba071cb2e7bb6ca44272e0b85e 100644 (file)
@@ -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 (