DefaultConfig returns a Config with sensible defaults.
()
| 134 | |
| 135 | // DefaultConfig returns a Config with sensible defaults. |
| 136 | func DefaultConfig() *Config { |
| 137 | return &Config{ |
| 138 | Mode: ModeAuto, // Enable by default for Redis Cloud |
| 139 | EndpointType: EndpointTypeAuto, // Auto-detect based on connection |
| 140 | RelaxedTimeout: 10 * time.Second, |
| 141 | HandoffTimeout: 15 * time.Second, |
| 142 | MaxWorkers: 0, // Auto-calculated based on pool size |
| 143 | HandoffQueueSize: 0, // Auto-calculated based on max workers |
| 144 | PostHandoffRelaxedDuration: 0, // Auto-calculated based on relaxed timeout |
| 145 | |
| 146 | // Circuit breaker configuration |
| 147 | CircuitBreakerFailureThreshold: 5, |
| 148 | CircuitBreakerResetTimeout: 60 * time.Second, |
| 149 | CircuitBreakerMaxRequests: 3, |
| 150 | |
| 151 | // Connection Handoff Configuration |
| 152 | MaxHandoffRetries: 3, |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | // Validate checks if the configuration is valid. |
| 157 | func (c *Config) Validate() error { |
no outgoing calls