Repository navigation
fix: keep module defaults for fields a preset leaves undefined - #47
Merged
kamilmysliwiec merged 1 commit intoNov 9, 2026
Merged
Conversation
Drop `undefined` fields of circuit breaker, bulkhead and backoff options
before merging them over the module defaults, as retry options already
do. A preset or `ResilienceService.create()` field set to `undefined`,
such as an unset setting from `ConfigService.get()`, replaced the module
default for that field: `circuitBreaker: { minimumCalls: undefined }`
under `defaults.circuitBreaker.minimumCalls: 1` gave the built-in 10.
Move `definedFields()` to `utils/options.util.ts`, so the registries can
use it without importing `PolicyFactory`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
A circuit breaker, bulkhead or backoff field that a preset (or
ResilienceService.create()) sets toundefinedreplaces the module default instead of inheriting it.ConfigService.get()givesundefinedfor a setting that isn't set:The same happens to
retry.backofffields (backoff: { delay: undefined }dropsdefaults.retry.backoff.delay). Top-level retry options and decorator options already skipundefinedfields (definedFields()). (A value parsed from an unset variable, such asNumber(process.env.X), isNaNinstead, which already fails the boot naming the option.)Issue Number: N/A
What is the new behavior?
undefinedfields are dropped before circuit breaker, bulkhead and backoff options are merged over the module defaults, as they already are for retry options.definedFields()moves toutils/options.util.tsso the registries can use it without importingPolicyFactory.Does this PR introduce a breaking change?
Other information
A field set to
undefinednow always inherits. Sobulkhead: { queueTimeout: undefined }in a preset no longer removes adefaults.bulkhead.queueTimeout; there is no other value for "no limit" there (Infinityis rejected as a duration).