-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Replace default health check and failure detector with custom #3822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fe0ebf0
ad4483e
c8010af
24655e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -28,19 +28,21 @@ class MultiDBClient(AsyncRedisModuleCommands, AsyncCoreCommands): | |||||||||||||||||
|
|
||||||||||||||||||
| def __init__(self, config: MultiDbConfig): | ||||||||||||||||||
| self._databases = config.databases() | ||||||||||||||||||
| self._health_checks = config.default_health_checks() | ||||||||||||||||||
|
|
||||||||||||||||||
| if config.health_checks is not None: | ||||||||||||||||||
| self._health_checks.extend(config.health_checks) | ||||||||||||||||||
| self._health_checks = ( | ||||||||||||||||||
| config.default_health_checks() | ||||||||||||||||||
| if not config.health_checks | ||||||||||||||||||
| else config.health_checks | ||||||||||||||||||
| ) | ||||||||||||||||||
|
|
||||||||||||||||||
| self._health_check_interval = config.health_check_interval | ||||||||||||||||||
| self._health_check_policy: HealthCheckPolicy = config.health_check_policy.value( | ||||||||||||||||||
| config.health_check_probes, config.health_check_delay | ||||||||||||||||||
| ) | ||||||||||||||||||
| self._failure_detectors = config.default_failure_detectors() | ||||||||||||||||||
|
|
||||||||||||||||||
| if config.failure_detectors is not None: | ||||||||||||||||||
| self._failure_detectors.extend(config.failure_detectors) | ||||||||||||||||||
| self._failure_detectors = ( | ||||||||||||||||||
| config.default_failure_detectors() | ||||||||||||||||||
| if not config.failure_detectors | ||||||||||||||||||
| else config.failure_detectors | ||||||||||||||||||
| ) | ||||||||||||||||||
|
Comment on lines
+41
to
+45
|
||||||||||||||||||
| self._failure_detectors = ( | |
| config.default_failure_detectors() | |
| if not config.failure_detectors | |
| else config.failure_detectors | |
| ) | |
| self._failure_detectors = config.default_failure_detectors() | |
| if config.failure_detectors: | |
| self._failure_detectors.extend(config.failure_detectors) |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,19 +29,20 @@ class MultiDBClient(RedisModuleCommands, CoreCommands): | |||||||||||||||||||
|
|
||||||||||||||||||||
| def __init__(self, config: MultiDbConfig): | ||||||||||||||||||||
| self._databases = config.databases() | ||||||||||||||||||||
| self._health_checks = config.default_health_checks() | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if config.health_checks is not None: | ||||||||||||||||||||
| self._health_checks.extend(config.health_checks) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| self._health_checks = ( | ||||||||||||||||||||
| config.default_health_checks() | ||||||||||||||||||||
| if not config.health_checks | ||||||||||||||||||||
| else config.health_checks | ||||||||||||||||||||
| ) | ||||||||||||||||||||
|
Comment on lines
+32
to
+36
|
||||||||||||||||||||
| self._health_checks = ( | |
| config.default_health_checks() | |
| if not config.health_checks | |
| else config.health_checks | |
| ) | |
| if config.health_checks: | |
| self._health_checks = config.default_health_checks() + config.health_checks | |
| else: | |
| self._health_checks = config.default_health_checks() |
Copilot
AI
Oct 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change breaks backward compatibility. Previously, custom failure_detectors were added to the defaults via extend(), allowing users to augment default behavior. Now they completely replace defaults. Users who expected to add additional detectors alongside the default CommandFailureDetector will lose the default detector. Consider providing a clear migration path or maintaining the extending behavior.
| self._failure_detectors = ( | |
| config.default_failure_detectors() | |
| if not config.failure_detectors | |
| else config.failure_detectors | |
| ) | |
| self._failure_detectors = config.default_failure_detectors() | |
| if config.failure_detectors: | |
| self._failure_detectors.extend(config.failure_detectors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change breaks backward compatibility. Previously, custom health_checks were added to the defaults via
extend(), allowing users to augment default behavior. Now they completely replace defaults. Users who expected to add additional checks alongside the default PingHealthCheck will lose the default check. Consider providing a clear migration path or maintaining the extending behavior.