Skip to content

Commit

Permalink
Make recursive true as default (#1243)
Browse files Browse the repository at this point in the history
Signed-off-by: Shivam Kumar <[email protected]>
  • Loading branch information
shivamkm07 authored Feb 20, 2024
1 parent 17b504c commit 5922fd7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Dapr.Workflow/Dapr.Workflow.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.DurableTask.Client.Grpc" Version="1.0.*" />
<PackageReference Include="Microsoft.DurableTask.Worker.Grpc" Version="1.0.*" />
<PackageReference Include="Microsoft.DurableTask.Client.Grpc" Version="1.2.*" />
<PackageReference Include="Microsoft.DurableTask.Worker.Grpc" Version="1.2.*" />
</ItemGroup>

<ItemGroup>
Expand Down
20 changes: 14 additions & 6 deletions src/Dapr.Workflow/DaprWorkflowClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ public async Task<WorkflowState> WaitForWorkflowCompletionAsync(
/// the terminated state.
/// </para>
/// <para>
/// Terminating a workflow instance has no effect on any in-flight activity function executions
/// or child workflows that were started by the terminated instance. Those actions will continue to run
/// without interruption. However, their results will be discarded. If you want to terminate child-workflows,
/// you must issue separate terminate commands for each child workflow instance individually.
/// Terminating a workflow terminates all of the child workflow instances that were created by the target. But it
/// has no effect on any in-flight activity function executions
/// that were started by the terminated instance. Those actions will continue to run
/// without interruption. However, their results will be discarded.
/// </para><para>
/// At the time of writing, there is no way to terminate an in-flight activity execution.
/// </para>
Expand All @@ -178,7 +178,11 @@ public Task TerminateWorkflowAsync(
string? output = null,
CancellationToken cancellation = default)
{
return this.innerClient.TerminateInstanceAsync(instanceId, output, cancellation);
TerminateInstanceOptions options = new TerminateInstanceOptions {
Output = output,
Recursive = true,
};
return this.innerClient.TerminateInstanceAsync(instanceId, options, cancellation);
}

/// <summary>
Expand Down Expand Up @@ -269,6 +273,9 @@ public Task ResumeWorkflowAsync(
/// <see cref="WorkflowRuntimeStatus.Completed"/>, <see cref="WorkflowRuntimeStatus.Failed"/>, or
/// <see cref="WorkflowRuntimeStatus.Terminated"/> state can be purged.
/// </para>
/// <para>
/// Purging a workflow purges all of the child workflows that were created by the target.
/// </para>
/// </remarks>
/// <param name="instanceId">The unique ID of the workflow instance to purge.</param>
/// <param name="cancellation">
Expand All @@ -280,7 +287,8 @@ public Task ResumeWorkflowAsync(
/// </returns>
public async Task<bool> PurgeInstanceAsync(string instanceId, CancellationToken cancellation = default)
{
PurgeResult result = await this.innerClient.PurgeInstanceAsync(instanceId, cancellation);
PurgeInstanceOptions options = new PurgeInstanceOptions {Recursive = true};
PurgeResult result = await this.innerClient.PurgeInstanceAsync(instanceId, options, cancellation);
return result.PurgedInstanceCount > 0;
}

Expand Down

0 comments on commit 5922fd7

Please sign in to comment.