diff options
author | Graeme Fowler <graemef@exim.org> | 2018-03-06 11:24:10 +0000 |
---|---|---|
committer | Graeme Fowler <graemef@exim.org> | 2018-03-06 11:24:10 +0000 |
commit | 0d0ace194a602607133e569319652c7b7b8f0e22 (patch) | |
tree | f44f68cc2bb399486e4b9b485eee0716d2b48703 /src | |
parent | 798a7ffec9e43ff4f0164d75d4cc2fb82208a7bf (diff) |
Cheap method to follow redis cluster MOVED replies
Diffstat (limited to 'src')
-rw-r--r-- | src/src/lookups/redis.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/src/lookups/redis.c b/src/src/lookups/redis.c index db408d993..c36b1bda7 100644 --- a/src/src/lookups/redis.c +++ b/src/src/lookups/redis.c @@ -241,7 +241,20 @@ switch (redis_reply->type) { case REDIS_REPLY_ERROR: *errmsg = string_sprintf("REDIS: lookup result failed: %s\n", redis_reply->str); - *defer_break = FALSE; + + /* trap MOVED cluster responses and follow them */ + if (Ustrncmp(redis_reply->str, "MOVED", 5)) + { + DEBUG(D_lookup) + debug_printf("REDIS: cluster redirect %s\n", redis_reply->str); + /* follow redirect + This is cheating, we simply set defer_break = TRUE to move on to + the next server in the redis_servers list */ + *defer_break = TRUE; + return DEFER; + } else { + *defer_break = FALSE; + } *do_cache = 0; goto REDIS_EXIT; /* NOTREACHED */ |