NewLife/Stardust

使用竞速下载
智能大石头 authored at 2026-01-09 02:08:27
94fd815
Tree
1 Parent(s) 8ec133a
Summary: 1 changed files with 4 additions and 1 deletions.
Modified +4 -1
Modified +4 -1
diff --git a/Stardust/Storages/DefaultFileStorage.cs b/Stardust/Storages/DefaultFileStorage.cs
index b05a4cf..bd3f23b 100644
--- a/Stardust/Storages/DefaultFileStorage.cs
+++ b/Stardust/Storages/DefaultFileStorage.cs
@@ -211,6 +211,7 @@ public abstract class DefaultFileStorage : DisposeBase, IFileStorage, ILogFeatur
             {
                 client = new ApiHttpClient
                 {
+                    LoadBalanceMode = LoadBalanceMode.Race,
                     DefaultUserAgent = HttpHelper.DefaultUserAgent,
                     Timeout = 3_000,
                     Tracer = Tracer,
@@ -222,7 +223,9 @@ public abstract class DefaultFileStorage : DisposeBase, IFileStorage, ILogFeatur
                 _cache.Set(key, client, 600);
             }
 
-            await client.DownloadFileAsync(url, fileName, file.Hash, cancellationToken).ConfigureAwait(false);
+            //await client.DownloadFileAsync(url, fileName, file.Hash, cancellationToken).ConfigureAwait(false);
+            // 使用竞速下载
+            await client.DownloadFileRaceAsync(url, fileName, file.Hash, false, cancellationToken).ConfigureAwait(false);
 
             WriteLog("下载文件:{0},成功:{1}", file.Name, client.Current?.Address);
         }