跳转到内容
简体中文

readCircuitBreakerOptionsFromConfig

此内容尚不支持你的语言。

readCircuitBreakerOptionsFromConfig(config, keys?): Partial<CircuitBreakerOptionsType>

Defined in: src/pattern/CircuitBreakerOptions.ts:321

Read one actor-ts.circuit-breaker.* block, omitting absent leaves so an unset one falls through to the layer below instead of shadowing it — the rule mergeOptions encodes.

Leaf names are the kebab-case of the CircuitBreakerOptionsType fields with any unit suffix dropped (#1405), so resetTimeoutMs is read from reset-timeout; getDuration takes 15s and a bare millisecond count alike. backoff-factor and random-factor go through getNumber and not getInt, which throws outright on 0.2.

call-timeout is deliberately not in reference.conf. Omitting callTimeoutMs is what disables the per-call timeout, and the validator refuses 0, so “no deadline” is a state only a missing key can express — the same reason actor-ts.cache.redis.host is a comment. Publishing a real default here would hand every config-resolved breaker a deadline that a hand-built one does not have. The key is still read, so a deployment that writes it gets it.

Config

CircuitBreakerKeys = ConfigKeys.circuitBreaker.default

Partial<CircuitBreakerOptionsType>