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 1
1
from typing import Union , Dict , Tuple , Type
2
2
3
3
import redis
4
- import valkey
4
+ try :
5
+ import valkey
6
+ except ImportError :
7
+ valkey = redis
5
8
6
9
from scheduler .settings import Broker
7
10
8
11
ConnectionErrorType = Union [redis .ConnectionError , valkey .ConnectionError ]
9
- ConnectionType = Union [redis .Redis , valkey .Valkey ]
12
+ ConnectionType = Union [redis .Redis , valkey .Redis ]
10
13
PipelineType = Union [redis .client .Pipeline , valkey .client .Pipeline ]
11
14
RedisSentinel = redis .sentinel .Sentinel
15
+ ValkeySentinel = valkey .sentinel .Sentinel
12
16
13
17
BrokerConnectionClass : Dict [Tuple [Broker , bool ], Type ] = {
14
18
# Map of (Broker, Strict flag) => Connection Class
15
19
(Broker .REDIS , False ): redis .Redis ,
16
- (Broker .VALKEY , False ): valkey .Valkey ,
20
+ (Broker .VALKEY , False ): valkey .Redis ,
17
21
(Broker .REDIS , True ): redis .StrictRedis ,
18
22
(Broker .VALKEY , True ): valkey .StrictValkey ,
19
23
}
You can’t perform that action at this time.
0 commit comments