Skip to content

Commit 661b6a3

Browse files
Perform cheaper PHP liveness check first.
1 parent ae5469e commit 661b6a3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

library.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2266,17 +2266,15 @@ redis_sock_check_liveness(RedisSock *redis_sock)
22662266
smart_string cmd = {0};
22672267
size_t len;
22682268

2269+
/* Short circuit if PHP detects the stream isn't live */
2270+
if (redis_stream_liveness_check(redis_sock->stream) != SUCCESS)
2271+
goto failure;
2272+
22692273
/* Short circuit if we detect the stream is "dirty", can't or are
22702274
configured not to try and fix it */
22712275
if (redis_stream_detect_dirty(redis_sock->stream) != SUCCESS)
22722276
goto failure;
22732277

2274-
/* Short circuit if we detect the stream has gone bad or if the user has
2275-
* configured persistent connection "YOLO mode". */
2276-
if (redis_stream_liveness_check(redis_sock->stream) != SUCCESS) {
2277-
goto failure;
2278-
}
2279-
22802278
redis_sock->status = REDIS_SOCK_STATUS_CONNECTED;
22812279
if (!INI_INT("redis.pconnect.echo_check_liveness")) {
22822280
return SUCCESS;

0 commit comments

Comments
 (0)