-
Notifications
You must be signed in to change notification settings - Fork 184
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
Define Retry Policy Attributes #977
Conversation
…tomatically deserialize without extra parsing
Additionally conducted manual verification by running this E2E with the host and inspecting loaded FunctionMetadata to check Retry information was populated correctly. Currently investigating to see what other tests we may need/want for this feature. |
extensions/Worker.Extensions.Abstractions/src/FixedDelayRetryAttribute.cs
Show resolved
Hide resolved
extensions/Worker.Extensions.Abstractions/src/FixedDelayRetryAttribute.cs
Outdated
Show resolved
Hide resolved
extensions/Worker.Extensions.Abstractions/src/ExponentialBackoffRetryAttribute.cs
Show resolved
Hide resolved
extensions/Worker.Extensions.Abstractions/src/FixedDelayRetryAttribute.cs
Show resolved
Hide resolved
extensions/Worker.Extensions.Abstractions/src/ExponentialBackoffRetryAttribute.cs
Outdated
Show resolved
Hide resolved
@@ -11,7 +11,7 @@ | |||
|
|||
<ItemGroup> | |||
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.25" /> | |||
<PackageReference Include="Microsoft.Azure.WebJobs.Script.Abstractions" Version="1.0.0-preview" /> | |||
<PackageReference Include="Microsoft.Azure.WebJobs.Script.Abstractions" Version="1.0.3-preview" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 1.0.3 instead of 1.0.1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just grabbed the latest available we had.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only see 1.0.0-preview. https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Script.Abstractions/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The host uses 1.0.3-preview which is the latest (only published internally). RetryOptions do show up in 1.0.1-preview first, but there's also an update to the RetryOptions class in 1.0.2-preview. Don't know the progress on a public release for these, but I think we can match the host version without issues. If we only want to consume RetryOptions changes we can pick 1.0.2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💰
extensions/Worker.Extensions.Abstractions/src/FixedDelayRetryAttribute.cs
Show resolved
Hide resolved
extensions/Worker.Extensions.Abstractions/src/FixedDelayRetryAttribute.cs
Outdated
Show resolved
Hide resolved
@@ -11,7 +11,7 @@ | |||
|
|||
<ItemGroup> | |||
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.25" /> | |||
<PackageReference Include="Microsoft.Azure.WebJobs.Script.Abstractions" Version="1.0.0-preview" /> | |||
<PackageReference Include="Microsoft.Azure.WebJobs.Script.Abstractions" Version="1.0.3-preview" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only see 1.0.0-preview. https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Script.Abstractions/
@@ -23,5 +23,7 @@ internal class SdkFunctionMetadata | |||
public IDictionary<string, object> Properties { get; set; } = new Dictionary<string, object>(); | |||
|
|||
public Collection<ExpandoObject> Bindings { get; set; } = new Collection<ExpandoObject>(); | |||
|
|||
public SdkRetryOptions? Retry { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to update the source gen version of metadata generation with this prop as well. Correct? Perhaps a follow up PR later.
extensions/Worker.Extensions.Abstractions/src/ExponentialBackoffRetryAttribute.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
|
||
private static void ValidateIntervals(TimeSpan minimumInterval, TimeSpan maximumInterval) | ||
{ | ||
if (minimumInterval.Ticks < 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What string input(for minimumInterval) will produce a TimeSpan instance with negative value for Ticks property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"-00:00:10" passes the TimeSpan.Parse check and fails this check.
[AttributeUsage(AttributeTargets.Method)] | ||
public abstract class RetryAttribute : Attribute | ||
{ | ||
public RetryAttribute() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this public constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intent was to stylistically match the other attribute classes (binding attribute, input binding attribute, etc).
samples/FunctionApp/HttpTriggerWithBlobInput/HttpTriggerWithBlobInput.cs
Show resolved
Hide resolved
test/FunctionMetadataGeneratorTests/FunctionMetadataGeneratorTests.cs
Outdated
Show resolved
Hide resolved
/check-enforcer evaluate |
/check-enforcer evaluate |
/check-enforcer override |
Issue describing the changes in this PR
#971
Pull request checklist
release_notes.md
Additional information
FixedDelayRetry
andExponentialBackoffRetry
attributes toWorker.Extensions.Abstractions
.FunctionMetadataGenerator
in the SDK has the ability to parse Retry Attributes and write them tofunctions.metadata
JSON file.FunctionMetadataLoaderExtension
is updated to use v1.0.3-preview ofMicrosoft.Azure.WebJobs.Script.Abstractions
so thatFunctionMetadata
has theRetry
property and the JSON Reader can deserialize JObjects from thefunctions.metadata
file intoFunctionMetadata
as is without code changes.