statsig-io / dotnet-sdk

Statsig SDK for .NET applications on both client and server sides
ISC License
2 stars 6 forks source link

CancellationToken Support #12

Closed mitchell-arthur-wealth closed 2 years ago

mitchell-arthur-wealth commented 2 years ago

Enhancement Request:

In the StatsigClient, we need CancellationToken in the Initialize and UpdateUser methods. This will allow use to timeout any asynchronous connections to Statsig if there are any long running connection issues.

https://github.com/statsig-io/dotnet-sdk/blob/5a32f584414e3b503393b7d62f5209aab4292f2f/dotnet-statsig/src/Statsig/Client/StatsigClient.cs#L11

https://github.com/statsig-io/dotnet-sdk/blob/5a32f584414e3b503393b7d62f5209aab4292f2f/dotnet-statsig/src/Statsig/Client/StatsigClient.cs#L80

jkw-statsig commented 2 years ago

Thanks for the request. We will provide an update when this is added

jkw-statsig commented 2 years ago

Hi @mitchell-arthur-wealth - looking at this request now. For our other SDKs, we have a timeout option for you to configure to decide how long you want to wait for network requests, so it would be preferable if we keep the same pattern here. Would something like https://github.com/statsig-io/dotnet-sdk/pull/17 work for you too?

mitchell-arthur-wealth commented 2 years ago

@jkw-statsig I think the CancellationToken is more flexible, but were going to use the CancellationToken to configure a timeout so this works for me! 😄

jkw-statsig commented 2 years ago

yeah I agree. I think they can co-exist, so if a cancellation token is needed where a timeout wouldn't work, we're happy to add that in the future. For now let me get this added quickly so you can get unblocked sooner.

mitchell-arthur-wealth commented 2 years ago

Sounds good, thanks!

jkw-statsig commented 2 years ago

@mitchell-arthur-wealth a new version was just published with this option https://github.com/statsig-io/dotnet-sdk/releases/tag/v1.11.0