Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial workflow client #14

Merged
merged 13 commits into from
Jan 30, 2023
Prev Previous commit
Next Next commit
Add threading analyzers
  • Loading branch information
cretz committed Jan 26, 2023
commit fc398576ca4c9f47af53eb006753cc6d8af149a5
3 changes: 2 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<!-- Run StyleCop only on latest .NET version -->
<!-- Run Analyzers only on latest .NET version -->
<ItemGroup Condition="'$(TargetFramework)' != 'net462' And '$(TargetFramework)' != 'netstandard2.0'">
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.4.33" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" PrivateAssets="all" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Temporalio/Bridge/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static async Task<Client> ConnectAsync(
/// <param name="timeout">Timeout for the call.</param>
/// <param name="cancellationToken">Cancellation token for the call.</param>
/// <returns>Response proto.</returns>
public async Task<T> Call<T>(
public async Task<T> CallAsync<T>(
Interop.RpcService service,
string rpc,
IMessage req,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ public virtual Task<TResult> QueryWorkflowAsync<TResult>(QueryWorkflowInput inpu
/// <returns>
/// Event page. This will not return an empty event set and a next page token.
/// </returns>
public virtual Task<WorkflowHistoryEventPage> FetchWorkflowHistoryEventPage(
public virtual Task<WorkflowHistoryEventPage> FetchWorkflowHistoryEventPageAsync(
FetchWorkflowHistoryEventPageInput input)
{
return Next.FetchWorkflowHistoryEventPage(input);
return Next.FetchWorkflowHistoryEventPageAsync(input);
}

// TODO(cretz): Lots more
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Temporalio.Client.Interceptors
{
/// <summary>
/// Input for <see cref="ClientOutboundInterceptor.FetchWorkflowHistoryEventPage" />.
/// Input for <see cref="ClientOutboundInterceptor.FetchWorkflowHistoryEventPageAsync" />.
/// </summary>
/// <param name="ID">ID of the workflow.</param>
/// <param name="RunID">Optional run ID of the workflow.</param>
Expand Down
6 changes: 3 additions & 3 deletions src/Temporalio/Client/TemporalClient.Workflow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public override async Task<WorkflowHandle<TResult>> StartWorkflowAsync<TResult>(
{
try
{
return await StartWorkflowAsyncUnwrapped<TResult>(input);
return await StartWorkflowInternalAsync<TResult>(input);
}
catch (RpcException e) when (
e.Code == RpcException.StatusCode.AlreadyExists)
Expand Down Expand Up @@ -222,7 +222,7 @@ public override async Task<TResult> QueryWorkflowAsync<TResult>(QueryWorkflowInp
}

/// <inheritdoc />
public override async Task<WorkflowHistoryEventPage> FetchWorkflowHistoryEventPage(
public override async Task<WorkflowHistoryEventPage> FetchWorkflowHistoryEventPageAsync(
FetchWorkflowHistoryEventPageInput input)
{
var req = new GetWorkflowExecutionHistoryRequest()
Expand Down Expand Up @@ -261,7 +261,7 @@ public override async Task<WorkflowHistoryEventPage> FetchWorkflowHistoryEventPa
}
}

private async Task<WorkflowHandle<TResult>> StartWorkflowAsyncUnwrapped<TResult>(
private async Task<WorkflowHandle<TResult>> StartWorkflowInternalAsync<TResult>(
StartWorkflowInput input)
{
// We will build the non-signal-with-start request and convert to signal with start
Expand Down
2 changes: 1 addition & 1 deletion src/Temporalio/Client/TemporalConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ internal async Task<T> InvokeRpcAsync<T>(
RpcOptions? options = null)
where T : IMessage<T>
{
return await client.Call(
return await client.CallAsync(
service.Service,
rpc,
req,
Expand Down
2 changes: 1 addition & 1 deletion src/Temporalio/Client/WorkflowHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public async Task<TResult> GetResultAsync<TResult>(
var histRunID = ResultRunID;
while (true)
{
var page = await Client.OutboundInterceptor.FetchWorkflowHistoryEventPage(new(
var page = await Client.OutboundInterceptor.FetchWorkflowHistoryEventPageAsync(new(
ID: ID,
RunID: histRunID,
PageSize: 0,
Expand Down
3 changes: 3 additions & 0 deletions tests/Temporalio.Tests/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ dotnet_diagnostic.CS1591.severity = none
# Do not need docs in test project
dotnet_diagnostic.SA1600.severity = none

# Do not need to suffix tests with "Async"
dotnet_diagnostic.VSTHRD200.severity = none

###############################