MCPcopy
hub / github.com/redis/redis-py / __init__

Method __init__

redis/multidb/client.py:43–83  ·  view source on GitHub ↗
(self, config: MultiDbConfig)

Source from the content-addressed store, hash-verified

41 """
42
43 def __init__(self, config: MultiDbConfig):
44 self._databases = config.databases()
45 self._health_checks = (
46 config.default_health_checks()
47 if not config.health_checks
48 else config.health_checks
49 )
50 self._health_check_interval = config.health_check_interval
51 self._health_check_policy: HealthCheckPolicy = (
52 config.health_check_policy.value()
53 )
54 self._failure_detectors = (
55 config.default_failure_detectors()
56 if not config.failure_detectors
57 else config.failure_detectors
58 )
59
60 self._failover_strategy = (
61 config.default_failover_strategy()
62 if config.failover_strategy is None
63 else config.failover_strategy
64 )
65 self._failover_strategy.set_databases(self._databases)
66 self._auto_fallback_interval = config.auto_fallback_interval
67 self._event_dispatcher = config.event_dispatcher
68 self._command_retry = config.command_retry
69 self._command_retry.update_supported_errors((ConnectionRefusedError,))
70 self.command_executor = DefaultCommandExecutor(
71 failure_detectors=self._failure_detectors,
72 databases=self._databases,
73 command_retry=self._command_retry,
74 failover_strategy=self._failover_strategy,
75 failover_attempts=config.failover_attempts,
76 failover_delay=config.failover_delay,
77 event_dispatcher=self._event_dispatcher,
78 auto_fallback_interval=self._auto_fallback_interval,
79 )
80 self.initialized = False
81 self._bg_scheduler = BackgroundScheduler()
82 self._hc_lock = threading.Lock()
83 self._config = config
84
85 def __del__(self):
86 try:

Callers

nothing calls this directly

Calls 8

BackgroundSchedulerClass · 0.90
databasesMethod · 0.45
default_health_checksMethod · 0.45
set_databasesMethod · 0.45

Tested by

no test coverage detected