Skip to content

Conversation

AnatoliB
Copy link
Contributor

@AnatoliB AnatoliB commented Jan 26, 2021

Feature documentation: Automatic retry on failure.

Usage sample:

$retryOptions = New-DurableRetryOptions `
                        -FirstRetryInterval (New-Timespan -Seconds 1) `
                        -MaxNumberOfAttempts 5 `
                        -BackofCoefficient 1.5 `                        # Optional
                        -MaxRetryInterval (New-Timespan -Seconds 20) `  # Optional
                        -RetryTimeout (New-Timespan -Seconds 60)        # Optional

Invoke-ActivityFunction -FunctionName ... -Input ... -RetryOptions $retryOptions

@AnatoliB AnatoliB marked this pull request as ready for review January 26, 2021 19:25
Copy link
Contributor

@Francisco-Gamino Francisco-Gamino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks great. One minor comment. Other than that, LGM.

}

function New-DurableRetryOptions(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the last character in this line be a '{' instead of '('?

@Francisco-Gamino
Copy link
Contributor

Thanks @AnatoliB for adding the link to the docs.

The timespan parameters for New-DurableRetryOptions cmdlet did not feel intuitive at first. However, after taking a look at the examples in our docs https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-error-handling?tabs=csharp#automatic-retry-on-failure, there is a consistent experience across language offerings. Also, whenever the user does not pass a New-Timespan value, they will get a good error message from the parameter binder, so we are good to go.

@AnatoliB
Copy link
Contributor Author

The timespan parameters for New-DurableRetryOptions cmdlet did not feel intuitive at first. However, after taking a look at the examples in our docs https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-error-handling?tabs=csharp#automatic-retry-on-failure, there is a consistent experience across language offerings.

Yes, this is how I feel, too. We can incrementally improve this later by adding other parameters, or perhaps accepting numbers instead of timespan object and interpreting them as seconds automatically (if you have this kind of ideas in mind). But the basic minimal implementation should match the experience in other languages.

Thank you!

@AnatoliB AnatoliB merged commit 30250f4 into dev Feb 23, 2021
@AnatoliB AnatoliB deleted the anatolib/retry-policies-pr branch February 23, 2021 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants