mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 09:59:48 -05:00
Cancel Query Part 2 (#89)
Moving some logic around such that when a query is cancelled, it isn't thrown away, allowing reading of the partial results, a la SSMS. Adding a configure await to fix a tenacious bug causing query cancellations to hang for 20s or more. Capturing sql errors for user cancellation, to return all user cancelation scenarios using the same messages. (ie, cancelling during ExecuteReaderAsync will yield a error from the server whereas cancelling during ReadAsync throws a TaskCancelledException No changes to protocol, just implementation changes. * Test of try/finally * Fixed issue where resultsets are unreadable after query cancellation * Fix for await/async issue
This commit is contained in:
@@ -231,21 +231,8 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
||||
return;
|
||||
}
|
||||
|
||||
// Cancel the query
|
||||
// Cancel the query and send a success message
|
||||
result.Cancel();
|
||||
result.Dispose();
|
||||
|
||||
// Attempt to dispose the query
|
||||
if (!ActiveQueries.TryRemove(cancelParams.OwnerUri, out result))
|
||||
{
|
||||
// It really shouldn't be possible to get to this scenario, but we'll cover it anyhow
|
||||
await requestContext.SendResult(new QueryCancelResult
|
||||
{
|
||||
Messages = SR.QueryServiceCancelDisposeFailed
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
await requestContext.SendResult(new QueryCancelResult());
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
|
||||
Reference in New Issue
Block a user