Add Timeout support to PurgeInstancesFilter for partial purge#679
Closed
YunchuWang wants to merge 1 commit intomainfrom
Closed
Add Timeout support to PurgeInstancesFilter for partial purge#679YunchuWang wants to merge 1 commit intomainfrom
YunchuWang wants to merge 1 commit intomainfrom
Conversation
- Add TimeSpan? Timeout property to PurgeInstancesFilter - Send timeout as google.protobuf.Duration in gRPC PurgeInstanceFilter - Add timeout field (4) to PurgeInstanceFilter proto message - Enables callers to purge in time-bounded batches, checking IsComplete to loop
Contributor
There was a problem hiding this comment.
Pull request overview
Adds client-initiated, time-bounded purge support by extending the purge filter API and wiring the new value through the gRPC request contract, enabling iterative “partial purge” loops that return within a caller-specified time budget.
Changes:
- Add
TimeSpan? TimeouttoPurgeInstancesFilter(public API) for per-call purge time bounding. - Extend
PurgeInstanceFilterproto message withgoogle.protobuf.Duration timeout = 4. - Map
PurgeInstancesFilter.Timeoutinto the gRPC request inGrpcDurableTaskClient.PurgeAllInstancesAsync.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Grpc/orchestrator_service.proto | Adds timeout duration field to the purge filter proto message. |
| src/Client/Grpc/GrpcDurableTaskClient.cs | Sends Timeout as a protobuf Duration when provided. |
| src/Client/Core/PurgeInstancesFilter.cs | Introduces the new Timeout property and documents intended semantics. |
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+491
to
+494
| if (filter?.Timeout is not null) | ||
| { | ||
| request.PurgeInstanceFilter.Timeout = Google.Protobuf.WellKnownTypes.Duration.FromTimeSpan(filter.Timeout.Value); | ||
| } |
Comment on lines
+20
to
+22
| /// When set, the purge stops accepting new instances after this duration elapses | ||
| /// and returns with <see cref="PurgeResult.IsComplete"/> set to <c>false</c>. | ||
| /// Already-started instance deletions will complete before the method returns. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
TimeSpan? Timeoutproperty toPurgeInstancesFilterand send it asgoogle.protobuf.Durationin the gRPC proto request, enabling time-bounded partial purge operations.Motivation
When purging large numbers of orchestration instances through the isolated worker SDK, the gRPC call between worker and host times out before the purge completes. The caller receives
OperationCanceledExceptionwhile the host-side purge continues silently — making progress invisible and counts unreliable.With this change, callers can set a timeout (e.g., 25 seconds) on each purge call. The operation returns within the timeout with accurate counts and an
IsCompleteflag, allowing the caller to loop until all instances are purged.Changes
PurgeInstancesFilter: AddTimeSpan? Timeout { get; init; }propertyGrpcDurableTaskClient.PurgeAllInstancesAsync: Send timeout asgoogle.protobuf.Durationin proto requestgoogle.protobuf.Duration timeout = 4toPurgeInstanceFiltermessageUsage
Breaking Changes
None. The
Timeoutproperty is optional with a default ofnull(existing behavior unchanged).Dependencies