Skip to content

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

Open
YunchuWang wants to merge 3 commits intomainfrom
wangbill/partial-purge-timeout
Open

Add opt-in Timeout to PurgeInstancesFilter for partial purge#680
YunchuWang wants to merge 3 commits 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.

- Add ArgumentOutOfRangeException for zero/negative Timeout in PurgeAllInstancesAsync
- Update PurgeInstancesFilter.Timeout XML docs to note backend-dependent semantics
- Add 3 unit tests for Timeout validation (negative, zero, positive)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants