Skip to content

Null coalescing operator should not be used for setting default options #934

@ekarademir

Description

@ekarademir

The circuit breaker constructor is using null coalesce operators for some settings like timeout. However this can cause (and caused) unexpected behaviour down the line.

For instance timeout setting is falsey checked before use here. However due to null coalesce, NaN is a valid timeout setting and can be set if a consumer of the library is parsing an integer.

I guess you could argue NaN setting is working as expected (not timing out) but setTimeout treats NaN as 0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions