Skip to content

Commit

Permalink
Use a timeout when calling RequestShutdown()
Browse files Browse the repository at this point in the history
  • Loading branch information
yannickcholette committed Feb 13, 2024
1 parent 68680df commit 4fc7cb1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Client/LanguageClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,16 @@ public async Task Shutdown()
{
if (_connection.IsOpen)
{
await this.RequestShutdown().ConfigureAwait(false);
try
{
// this can get stuck forever, so use a timeout.
var cancelSource = new CancellationTokenSource();
cancelSource.CancelAfter(5 * 1000);

await this.RequestShutdown(cancelSource.Token).ConfigureAwait(false);
}
catch (TaskCanceledException) { }

this.SendExit();
}

Expand Down

0 comments on commit 4fc7cb1

Please sign in to comment.