Skip to content

Commit 5016334

Browse files
committed
Avoid cancelling all pending requests on shared HttpClient instance
1 parent 6220b34 commit 5016334

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ internal async Task InstallOrUpdateAsync(UserPlugin plugin)
153153
if (File.Exists(filePath))
154154
File.Delete(filePath);
155155

156-
using var response = await HttpClient.GetAsync(plugin.UrlDownload, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false);
156+
using var cts = new CancellationTokenSource();
157+
using var response = await HttpClient.GetAsync(plugin.UrlDownload, HttpCompletionOption.ResponseHeadersRead, cts.Token).ConfigureAwait(false);
157158

158159
response.EnsureSuccessStatusCode();
159160

@@ -166,7 +167,7 @@ internal async Task InstallOrUpdateAsync(UserPlugin plugin)
166167
{
167168
if (prgBox != null)
168169
{
169-
HttpClient.CancelPendingRequests();
170+
cts.Cancel();
170171
downloadCancelled = true;
171172
}
172173
})) != null)

0 commit comments

Comments
 (0)