From: Vsevolod Stakhov Date: Thu, 23 Jun 2016 17:27:07 +0000 (+0100) Subject: [Fix] Try to fix upstreams with one element X-Git-Tag: 1.3.0~265 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d0e29ef0e3644a852ee7439fa26bc65ebd3a1e7b;p=rspamd.git [Fix] Try to fix upstreams with one element --- diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c index 43d9f7448..8ea61bc20 100644 --- a/src/libutil/upstream.c +++ b/src/libutil/upstream.c @@ -416,7 +416,7 @@ rspamd_upstream_fail (struct upstream *up) max_error_rate = 0; } - if (error_rate > max_error_rate && up->active_idx != -1) { + if (up->ls->ups->len > 1 && error_rate > max_error_rate) { /* Remove upstream from the active list */ up->errors = 0; rspamd_upstream_set_inactive (up->ls, up); @@ -723,7 +723,10 @@ rspamd_upstream_restore_cb (gpointer elt, gpointer ls) /* Here the upstreams list is already locked */ RSPAMD_UPSTREAM_LOCK (up->lock); - event_del (&up->ev); + + if (event_get_base (&up->ev)) { + event_del (&up->ev); + } g_ptr_array_add (ups->alive, up); up->active_idx = ups->alive->len - 1; RSPAMD_UPSTREAM_UNLOCK (up->lock);