Skip to content

[Bug] RetryPolicy.maximumAttempt === 0 throws, while it is documented as a valid value for "unlimited" #1733

@jsamr

Description

@jsamr

What are you really trying to do?

Setting retry policy to "unlimited".

Describe the bug

In a workflow, call proxyActivities with the below retry policy object:

const retryPolicy = {
  maximumAttempts: 0
}

Minimal Reproduction

Not needed. The code below is at odds with the documentation:

if (retryPolicy.maximumAttempts != null) {
if (retryPolicy.maximumAttempts === Number.POSITIVE_INFINITY) {
// drop field (Infinity is the default)
const { maximumAttempts: _, ...without } = retryPolicy;
retryPolicy = without;
} else if (retryPolicy.maximumAttempts <= 0) {
throw new ValueError('RetryPolicy.maximumAttempts must be a positive integer');
} else if (!Number.isInteger(retryPolicy.maximumAttempts)) {
throw new ValueError('RetryPolicy.maximumAttempts must be an integer');
}
}

It throws when maximumAttempts is 0.

The documentation states the following:

Setting the [Maximum Attempts] value to 0 also means unlimited.

Environment/Versions

Not needed.

Additional context

The workaround is to set the value to Number.POSITIVE_INFINITY or undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions