diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-06-23 18:27:07 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-06-23 18:27:07 +0100 |
commit | d0e29ef0e3644a852ee7439fa26bc65ebd3a1e7b (patch) | |
tree | 88b0ca970b637f5c99c8cfe713f878209a1071df | |
parent | 0e09a5486513847905fb059185a7c5a32f50ead9 (diff) | |
download | rspamd-d0e29ef0e3644a852ee7439fa26bc65ebd3a1e7b.tar.gz rspamd-d0e29ef0e3644a852ee7439fa26bc65ebd3a1e7b.zip |
[Fix] Try to fix upstreams with one element
-rw-r--r-- | src/libutil/upstream.c | 7 |
1 files changed, 5 insertions, 2 deletions
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); |