From b46f4be88adfaf6db7e47a9591f14212a9e04a27 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 15 Mar 2016 14:57:04 +0000 Subject: [PATCH] [Feature] Add workaround for master-slave definitions --- src/libutil/upstream.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c index f22092289..020039d71 100644 --- a/src/libutil/upstream.c +++ b/src/libutil/upstream.c @@ -541,6 +541,14 @@ rspamd_upstreams_add_upstream (struct upstream_list *ups, g_ptr_array_free (addrs, TRUE); } + if (up->weight == 0 && ups->rot_alg == RSPAMD_UPSTREAM_MASTER_SLAVE) { + /* Special heuristic for master-slave rotation */ + if (ups->ups->len == 0) { + /* Prioritize the first */ + up->weight = 1; + } + } + g_ptr_array_add (ups->ups, up); up->ud = data; up->cur_weight = up->weight; -- 2.39.5