Force.com-Toolkit-for-NET icon indicating copy to clipboard operation
Force.com-Toolkit-for-NET copied to clipboard

Add CancellationToken Parameters to ForceClient

Open ghost opened this issue 6 years ago • 1 comments
trafficstars

As the ForceClient functions use async it would be good to pass a CancellationToken so any long running requests can be cancelled. The CancellationToken can be passed through to the ultimate calls on the HttpClient (e.g. HttpClient.PostAsync()).

For example, when running ForceClient functions from Azure Functions a CancellationToken is automatically provided by the infrastructure. If the Azure Functions are shut down or time out then a cancellation is requested by the infrastructure. Hopefully the HttpClient can then gracefully handle cancelling any requests.

For example ForceClient.RunJobAndPollAsync:

public async Task<List<BatchResultList>> RunJobAndPollAsync<T>(string objectName, BulkConstants.OperationType operationType, IEnumerable<ISObjectList<T>> recordsLists, CancellationToken cancellationToken = default(CancellationToken))

ghost avatar Dec 19 '18 00:12 ghost

Running into this issue as well. Doesn't seem this library is still maintained?

PR is even there: https://github.com/wadewegner/Force.com-Toolkit-for-NET/pull/251 :(

ghost avatar Nov 21 '22 14:11 ghost