Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2014-07-17 03:57:25 +0400
committermichael-grunder <michael.grunder@gmail.com>2015-05-06 01:05:29 +0300
commita65301bc2e9b678896675584e3a8e3219aa221f7 (patch)
tree3d87402ebe836cc74b83b3afc0a24d3c0ffad04f /cluster_library.h
parent5ed61ea3055c21cd635f1d8d1f103f81a38888a8 (diff)
Update redirection logic to throw on CLUSTERDOWN
When Redis Cluster responds with a CLUSTERDOWN error, we should throw an exception. It seems that in the current state of cluster (during slave election), it will enter a CLUSTERDOWN state for a short period of time. This allows clients to trap the exception and then either wait and try again, or do something else.
Diffstat (limited to 'cluster_library.h')
-rw-r--r--cluster_library.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/cluster_library.h b/cluster_library.h
index a4b44522..fb6b153e 100644
--- a/cluster_library.h
+++ b/cluster_library.h
@@ -74,7 +74,8 @@
efree(c->err); \
c->err = NULL; \
c->err_len = 0; \
- }
+ } \
+ c->clusterdown = 0;
/* Reset our last single line reply buffer and length */
#define CLUSTER_CLEAR_REPLY(c) \
@@ -195,8 +196,8 @@ typedef struct redisCluster {
/* Variable to store MULTI response */
zval *multi_resp;
- /* How many failures have we had in a row */
- int failures;
+ /* Flag for when we get a CLUSTERDOWN error */
+ short clusterdown;
/* The last ERROR we encountered */
char *err;