File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -747,6 +747,7 @@ def ensure_string(key):
747
747
class CacheProxyConnection (ConnectionInterface ):
748
748
DUMMY_CACHE_VALUE = b"foo"
749
749
MIN_ALLOWED_VERSION = "7.4.0"
750
+ DEFAULT_SERVER_NAME = b"redis"
750
751
751
752
def __init__ (self , conn : ConnectionInterface , cache : CacheInterface ):
752
753
self .pid = os .getpid ()
@@ -775,13 +776,17 @@ def set_parser(self, parser_class):
775
776
def connect (self ):
776
777
self ._conn .connect ()
777
778
778
- server_ver = self ._conn .handshake_metadata .get (b"version" , None )
779
+ server_name = self ._conn .handshake_metadata .get (b"server" )
780
+ server_ver = self ._conn .handshake_metadata .get (b"version" )
779
781
if server_ver is None :
780
782
raise ConnectionError ("Cannot retrieve information about server version" )
781
783
782
784
server_ver = server_ver .decode ("utf-8" )
783
785
784
- if compare_versions (server_ver , self .MIN_ALLOWED_VERSION ) == 1 :
786
+ if (
787
+ server_name != self .DEFAULT_SERVER_NAME
788
+ or compare_versions (server_ver , self .MIN_ALLOWED_VERSION ) == 1
789
+ ):
785
790
raise ConnectionError (
786
791
"To maximize compatibility with all Redis products, client-side caching is supported by Redis 7.4 or later" # noqa: E501
787
792
)
You can’t perform that action at this time.
0 commit comments