Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set both RetryPolicy and AsyncRetryHandler #281

Closed

Conversation

tomseida
Copy link
Contributor

@tomseida tomseida commented Apr 4, 2024

Add ability to set both RetryPolicy and AsyncRetryHandler for activity functions and suborchestrations.

See Issue #279

@tomseida
Copy link
Contributor Author

tomseida commented Apr 4, 2024

@microsoft-github-policy-service agree

@tomseida
Copy link
Contributor Author

tomseida commented Apr 5, 2024 via email

@Fazer01
Copy link

Fazer01 commented Apr 5, 2024

I'm also awaiting this functionality as we had this in place using the in-process variant. As we use .NET8 and isolated we are unable to use both the policy and retryhandler. It's either the policy or the handler, not both at the moment.

@stevie1706
Copy link

We are also waiting for this PR. Can it be reviewed and merged?

@cgillum
Copy link
Member

cgillum commented Apr 30, 2024

Hi - thanks for this PR!

Question: do you think the RetryPolicy and AsyncRetryHandler need to be combined, or is there a simpler solution where we just have a simple Func<Exception, bool> delegate (non-async) that can be applied to the RetryPolicy?

AsyncRetryHandler is really supposed to be used for advanced scheduling purposes and allows you to do everything a RetryPolicy can do and more. I'd like to keep these separate, if possible, and was hoping maybe you didn't need the full power of AsyncRetryHandler for your use case.

@tomseida
Copy link
Contributor Author

tomseida commented May 1, 2024

@cgillum, I have been using orchestrations for about 4 years and using RetryPolicy most of that time. A simple Func<Exception, bool> delegate applied to the RetryPolicy has always sufficed. I would be fine with keep this separate from AsyncRetryHandler.

@stevie1706
Copy link

Hi All, Are we able to get this reviewed and merged?

@cgillum
Copy link
Member

cgillum commented May 16, 2024

I'd like us to go with the simpler approach of adding a Func<Exception, bool> property to the RetryPolicy class to handle exception filtering. That can be done either in this PR or we can close this one and open a separate one.

@tomseida
Copy link
Contributor Author

@cgillum, below is my understanding of your suggestion. This looks exactly like how retries worked for in-process. I am in full support of this since it simplifies function app upgrades from in-process to isolated. Please confirm that the below modification to RetryPolicy meets expectations. I am going to assume it does and alter this PR to make this work.

    /// <summary>
    /// Gets or sets a delegate to call on exception to determine if retries should proceed.
    /// </summary>
    public Func<Exception, bool>? Handle { get; set; }

#pragma warning disable SA1623 // Property summary documentation should match accessors
    /// <summary>
    /// This functionality is not implemented. Will be removed in the future. Use RetryPolicy.Handle or TaskOptions.FromRetryHandler instead.
    /// </summary>
    [Obsolete("This functionality is not implemented. Will be removed in the future. Use RetryPolicy.Handle or TaskOptions.FromRetryHandler instead.")]
    public Func<Exception, Task<bool>>? HandleAsync { get; set; }
#pragma warning restore SA1623 // Property summary documentation should match accessors

@tomseida
Copy link
Contributor Author

Closing this pull request and replaced with PR #314 .

@tomseida tomseida closed this May 21, 2024
@tomseida tomseida deleted the feature/retrypolicy_and_handler branch May 21, 2024 02:52
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.

4 participants