Skip to content

Add opt-in Timeout to PurgeInstancesFilter for partial purge#680

Open
YunchuWang wants to merge 1 commit intomainfrom
wangbill/partial-purge-timeout
Open

Add opt-in Timeout to PurgeInstancesFilter for partial purge#680
YunchuWang wants to merge 1 commit intomainfrom
wangbill/partial-purge-timeout

Conversation

@YunchuWang
Copy link
Member

Summary

Add opt-in TimeSpan? Timeout property to PurgeInstancesFilter and send it as google.protobuf.Duration in the gRPC proto request.

Changes

  • PurgeInstancesFilter: Add TimeSpan? Timeout { get; init; } property (default null)
  • GrpcDurableTaskClient.PurgeAllInstancesAsync: Send timeout as google.protobuf.Duration in proto when set
  • Proto: Add google.protobuf.Duration timeout = 4 to PurgeInstanceFilter message

Usage

// Opt-in — existing callers unaffected
var filter = new PurgeInstancesFilter(from, to) { Timeout = TimeSpan.FromSeconds(25) };
var result = await client.PurgeAllInstancesAsync(filter);
// result.IsComplete == false → call again

Breaking Changes

None. Timeout defaults to null — existing behavior unchanged.

Replaces #679 (closed).

Dependencies

- Add TimeSpan? Timeout property to PurgeInstancesFilter (opt-in, default null)
- Send timeout as google.protobuf.Duration in gRPC request when set
- Add timeout field (4) to PurgeInstanceFilter proto message
- Zero breaking changes: existing callers unaffected
Copilot AI review requested due to automatic review settings March 19, 2026 05:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces an opt-in, per-call timeout for purge operations by extending the client-side PurgeInstancesFilter API and propagating the value through the gRPC contract to enable time-bounded (“partial”) purge behavior when supported by the backend.

Changes:

  • Add TimeSpan? Timeout (init-only) to PurgeInstancesFilter.
  • Send Timeout as google.protobuf.Duration in GrpcDurableTaskClient.PurgeAllInstancesAsync when provided.
  • Extend the gRPC proto PurgeInstanceFilter message with a new timeout field.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/Client/Core/PurgeInstancesFilter.cs Adds the new optional Timeout property and XML documentation.
src/Client/Grpc/GrpcDurableTaskClient.cs Maps PurgeInstancesFilter.Timeout into the gRPC request message.
src/Grpc/orchestrator_service.proto Extends PurgeInstanceFilter with google.protobuf.Duration timeout = 4.

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 +491 to +494
if (filter?.Timeout is not null)
{
request.PurgeInstanceFilter.Timeout = Google.Protobuf.WellKnownTypes.Duration.FromTimeSpan(filter.Timeout.Value);
}
Comment on lines +19 to +22
/// If <c>null</c> (default), all matching instances are purged with no time limit.
/// 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.
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