Skip to content

Commit 462d942

Browse files
committed
added valkey sentinel support
1 parent c4ebe16 commit 462d942

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scheduler/connection_types.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
from typing import Union, Dict, Tuple, Type
22

33
import redis
4-
import valkey
4+
try:
5+
import valkey
6+
except ImportError:
7+
valkey = redis
8+
valkey.Valkey = redis.Redis
59

610
from scheduler.settings import Broker
711

812
ConnectionErrorType = Union[redis.ConnectionError, valkey.ConnectionError]
913
ConnectionType = Union[redis.Redis, valkey.Valkey]
1014
PipelineType = Union[redis.client.Pipeline, valkey.client.Pipeline]
1115
RedisSentinel = redis.sentinel.Sentinel
16+
ValkeySentinel = valkey.sentinel.Sentinel
1217

1318
BrokerConnectionClass: Dict[Tuple[Broker, bool], Type] = {
1419
# Map of (Broker, Strict flag) => Connection Class

0 commit comments

Comments
 (0)