File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 11from typing import Union , Dict , Tuple , Type
22
33import redis
4- import valkey
4+ try :
5+ import valkey
6+ except ImportError :
7+ valkey = redis
58
69from scheduler .settings import Broker
710
811ConnectionErrorType = Union [redis .ConnectionError , valkey .ConnectionError ]
9- ConnectionType = Union [redis .Redis , valkey .Valkey ]
12+ ConnectionType = Union [redis .Redis , valkey .Redis ]
1013PipelineType = Union [redis .client .Pipeline , valkey .client .Pipeline ]
1114RedisSentinel = redis .sentinel .Sentinel
15+ ValkeySentinel = valkey .sentinel .Sentinel
1216
1317BrokerConnectionClass : Dict [Tuple [Broker , bool ], Type ] = {
1418 # Map of (Broker, Strict flag) => Connection Class
1519 (Broker .REDIS , False ): redis .Redis ,
16- (Broker .VALKEY , False ): valkey .Valkey ,
20+ (Broker .VALKEY , False ): valkey .Redis ,
1721 (Broker .REDIS , True ): redis .StrictRedis ,
1822 (Broker .VALKEY , True ): valkey .StrictValkey ,
1923}
You can’t perform that action at this time.
0 commit comments