From f3c33430b382e224d451c356ec1693ecebfeafaf Mon Sep 17 00:00:00 2001 From: thor-son Date: Wed, 29 Nov 2023 11:50:42 +0900 Subject: [PATCH] Include redisSock's persistent_id in persistent connection pool persistent_id string Fixes #1920 --- library.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/library.c b/library.c index c5f9820752..3d7d6f6a7f 100644 --- a/library.c +++ b/library.c @@ -881,6 +881,10 @@ redis_pool_spprintf(RedisSock *redis_sock, char *fmt, ...) { smart_str_append_ex(&str, redis_sock->host, 0); smart_str_appendc(&str, ':'); smart_str_append_long(&str, (zend_long)redis_sock->port); + if (redis_sock->persistent_id) { + smart_str_appendc(&str, ':'); + smart_str_append_ex(&str, redis_sock->persistent_id, 0); + } /* Short circuit if we don't have a pattern */ if (fmt == NULL) { @@ -890,15 +894,9 @@ redis_pool_spprintf(RedisSock *redis_sock, char *fmt, ...) { while (*fmt) { switch (*fmt) { - case 'i': - if (redis_sock->persistent_id) { - smart_str_appendc(&str, ':'); - smart_str_append_ex(&str, redis_sock->persistent_id, 0); - } - break; case 'u': - smart_str_appendc(&str, ':'); if (redis_sock->user) { + smart_str_appendc(&str, ':'); smart_str_append_ex(&str, redis_sock->user, 0); } break;