We have a scenario where a web request is being cancelled, but the queries triggered by the request are still either fully resolving or retrying despise the parent request being cancelled.
Our query looks like the following:
var dbo = await _dbContext.GetDbMapper().SingleAsync<TDbEntity>(cql);
Looking through the source code of the project (https://github.com/datastax/csharp-driver-graph), I'm not able to find any way to use cancellation tokens.
So my question real boils down to what is the best way to cancel my get request.
If there is not an ideal way to do this, what would be the best way to contact the DataStax team regarding possibly submitting a PR to resolve this?
As a possible solution, we could do something like WithCancellation to wrap the call and throw an exception upon timeout, but I think it would be more ideal to have the cancellation token go down the stack.
We are also working on limiting our retry policy to make the time after a cancelled request less impactful.
You can try something like:
and then cancel the request with this call:
However, this might not work for your case because I think the underlying Cassandra C# driver in the Graph extension you referenced does not support cancellation tokens. I'm going to reach out to the driver devs who can correct me if I'm wrong and get them to respond.
In any case, all contributions are welcome and encouraged. The best way to get started is to create a ticket in the project's JIRA with details of your proposal and a link to your PR (if you have one). For details, see Contributing to the Cassandra C# driver. Cheers!