-
Notifications
You must be signed in to change notification settings - Fork 271
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
Update MaxQueuePollingInterval default for Flex Consumption apps #2953
base: dev
Are you sure you want to change the base?
Conversation
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 change looks good to me! I think we just need to add some code comments explaining why we have this new logic (to remind our future selves and/or future maintainers).
Oh, and let's make sure we update the release notes with this information so that we have this change nicely documented for people to see. |
public TimeSpan MaxQueuePollingInterval { get; set; } = TimeSpan.FromSeconds(30); | ||
public TimeSpan MaxQueuePollingInterval | ||
{ | ||
get |
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.
If I'm reading this implementation correctly, this get
will always override the maxQueuePollingInterval
field with the default based on the env variable, so set
will not even matter, which is probably not the intent. Consider adding a unit test that confirms that the value passed to set
is actually returned by the next get
. On the implementation side, consider using Lazy<TimeSpan>
for maxQueuePollingInterval
.
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.
Ah, I totally missed that. Good call - we need to check to see whether the value has been initialized already and not initialize it again. Another option to consider is defaulting to a dummy value, like TimeSpan.Zero
which has the benefit of being a non-breaking change.
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 added a change to check for if this.maxQueuePollingInterval == TimeSpan.Zero
(since TimeSpan.Zero
is the default value for TimeSpan
) before setting the queue polling default setting. If it's not TimeSpan.Zero
, then it just returns the current value of this.maxQueuePollingInterval.
Is this a reasonable fix or should I go with another approach (e.g. using Lazy<TimeSpan>
)?
I also added unit tests for AzureStorageOptions
.
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 Lazy<TimeSpan>
idea will not actually work because Lazy
doesn't have a setter, and I forgot about it. Your approach makes sense, thank you.
This PR updates the
MaxQueuePollingInterval
to a default of 1 second instead of 30 seconds if the app is running on a Flex Consumption plan to help with cold start latency specific to Durable Functions Flex Consumption apps.Note: This is a draft PR since we need to finalize if 1 second is the new default we would like to go with for Flex Consumption apps.
Pull request checklist
pending_docs.md
release_notes.md
/src/Worker.Extensions.DurableTask/AssemblyInfo.cs