Skip to content

Commit be3c6c5

Browse files
authored
Add GetInstanceAsync overload to address plural typo (#118)
1 parent 7891118 commit be3c6c5

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

src/Client/Core/DurableTaskClient.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
using System.ComponentModel;
45
using Microsoft.DurableTask.Internal;
56

67
namespace Microsoft.DurableTask.Client;
@@ -73,7 +74,7 @@ public virtual Task<string> ScheduleNewOrchestrationInstanceAsync(
7374
/// and health of the backend task hub, and whether a start time was provided via <paramref name="options" />.
7475
/// </para><para>
7576
/// The task associated with this method completes after the orchestration instance was successfully scheduled. You
76-
/// can use the <see cref="GetInstancesAsync(string, bool, CancellationToken)"/> to query the status of the
77+
/// can use the <see cref="GetInstanceAsync(string, bool, CancellationToken)"/> to query the status of the
7778
/// scheduled instance, the <see cref="WaitForInstanceStartAsync(string, bool, CancellationToken)"/> method to wait
7879
/// for the instance to transition out of the <see cref="OrchestrationRuntimeStatus.Pending"/> status, or the
7980
/// <see cref="WaitForInstanceCompletionAsync(string, bool, CancellationToken)"/> method to wait for the instance to
@@ -270,7 +271,27 @@ public virtual Task ResumeInstanceAsync(string instanceId, CancellationToken can
270271
public abstract Task ResumeInstanceAsync(
271272
string instanceId, string? reason = null, CancellationToken cancellation = default);
272273

274+
/// <inheritdoc cref="GetInstanceAsync(string, bool, CancellationToken)"/>
275+
public virtual Task<OrchestrationMetadata?> GetInstanceAsync(
276+
string instanceId, CancellationToken cancellation)
277+
=> this.GetInstanceAsync(instanceId, false, cancellation);
278+
279+
/// <summary>
280+
/// Fetches orchestration instance metadata from the configured durable store.
281+
/// </summary>
282+
/// <remarks>
283+
/// You can use the <paramref name="getInputsAndOutputs"/> parameter to determine whether to fetch input and
284+
/// output data for the target orchestration instance. If your code doesn't require access to this data, it's
285+
/// recommended that you set this parameter to <c>false</c> to minimize the network bandwidth, serialization, and
286+
/// memory costs associated with fetching the instance metadata.
287+
/// </remarks>
288+
/// <inheritdoc cref="WaitForInstanceStartAsync(string, bool, CancellationToken)"/>
289+
public virtual Task<OrchestrationMetadata?> GetInstanceAsync(
290+
string instanceId, bool getInputsAndOutputs = false, CancellationToken cancellation = default)
291+
=> this.GetInstancesAsync(instanceId, getInputsAndOutputs, cancellation);
292+
273293
/// <inheritdoc cref="GetInstancesAsync(string, bool, CancellationToken)"/>
294+
[EditorBrowsable(EditorBrowsableState.Never)] // use GetInstanceAsync
274295
public virtual Task<OrchestrationMetadata?> GetInstancesAsync(
275296
string instanceId, CancellationToken cancellation)
276297
=> this.GetInstancesAsync(instanceId, false, cancellation);
@@ -285,6 +306,7 @@ public abstract Task ResumeInstanceAsync(
285306
/// memory costs associated with fetching the instance metadata.
286307
/// </remarks>
287308
/// <inheritdoc cref="WaitForInstanceStartAsync(string, bool, CancellationToken)"/>
309+
[EditorBrowsable(EditorBrowsableState.Never)] // use GetInstanceAsync
288310
public abstract Task<OrchestrationMetadata?> GetInstancesAsync(
289311
string instanceId, bool getInputsAndOutputs = false, CancellationToken cancellation = default);
290312

src/Client/Grpc/GrpcDurableTaskClient.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ public override async Task SuspendInstanceAsync(
148148

149149
try
150150
{
151-
await this.sidecarClient.SuspendInstanceAsync(
152-
request, cancellationToken: cancellation);
151+
await this.sidecarClient.SuspendInstanceAsync(request, cancellationToken: cancellation);
153152
}
154153
catch (RpcException e) when (e.StatusCode == StatusCode.Cancelled)
155154
{
@@ -170,8 +169,7 @@ public override async Task ResumeInstanceAsync(
170169

171170
try
172171
{
173-
await this.sidecarClient.ResumeInstanceAsync(
174-
request, cancellationToken: cancellation);
172+
await this.sidecarClient.ResumeInstanceAsync(request, cancellationToken: cancellation);
175173
}
176174
catch (RpcException e) when (e.StatusCode == StatusCode.Cancelled)
177175
{

test/Grpc.IntegrationTests/GrpcDurableTaskClientIntegrationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ static void AssertMetadata(OrchestrationMetadata metadata, string instanceId, Or
4444
OrchestrationName, input: shouldThrow);
4545

4646
await server.Client.WaitForInstanceStartAsync(instanceId, default);
47-
OrchestrationMetadata? metadata = await server.Client.GetInstancesAsync(instanceId, false);
47+
OrchestrationMetadata? metadata = await server.Client.GetInstanceAsync(instanceId, false);
4848
AssertMetadata(metadata!, instanceId, OrchestrationRuntimeStatus.Running);
4949

5050
await server.Client.RaiseEventAsync(instanceId, "event", default);
5151
await server.Client.WaitForInstanceCompletionAsync(instanceId, default);
52-
metadata = await server.Client.GetInstancesAsync(instanceId, false);
52+
metadata = await server.Client.GetInstanceAsync(instanceId, false);
5353
AssertMetadata(
5454
metadata!,
5555
instanceId,

0 commit comments

Comments
 (0)