[Feature Request] Add CancellationToken parameter to TemporalClient.ConnectAsync and friends
cgillum opened this issue · comments
Is your feature request related to a problem? Please describe.
It's standard practice in .NET APIs that perform I/O to include a CancellationToken
parameter so that callers can abort I/O requests that take too long. TemporalClient.ConnectAsync(...)
doesn't accept a cancellation token.
Describe the solution you'd like
Add an optional CancellationToken
to TemporalClient.ConnectAsync(...)
, like so:
public static async Task<TemporalClient> ConnectAsync(
TemporalClientConnectOptions options,
CancellationToken cancellationToken = default) { ... }
This feedback applies to other APIs as well, such as TemporalConnection.ConnectAsync(...)
.
On every async call that supports cancellation we do accept a cancellation token, though we intentionally deviate from .NET here and include it in the options instead of as trailing parameter to keep the overload count down. This includes every call on a connected client.
But we intentionally did not include a cancellation token on connect because we don't have that wired up with Rust. It's not as easy as just cancelling a .NET task, I have to weave the token through Tokio in Rust. I put in this effort for RPC calls but not yet the connect process itself. I will look into putting this time in before beta. In the meantime know that the connection process cannot be trivially cancelled with a token.