Tune speedtest parallelism

Set `MaxDegreeOfParallelism` explicitly to the current selection size in three speed test parallel sections so task fan-out matches the workload. Also wrapped socket connect timing in a catch block that ignores connection exceptions, preventing a failed connect from aborting the flow while still completing cleanup.
https://github.com/2dust/v2rayN/issues/10246
This commit is contained in:
2dust
2026-09-28 10:28:32 +08:00
parent d433aa3b04
commit e0c790eeb2
@@ -210,6 +210,7 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
var parallelOptions = new ParallelOptions
{
MaxDegreeOfParallelism = lst.Count,
CancellationToken = ct,
};
@@ -291,6 +292,7 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
var parallelOptions = new ParallelOptions
{
MaxDegreeOfParallelism = selecteds.Count,
CancellationToken = ct,
};
@@ -381,6 +383,7 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
var parallelOptions = new ParallelOptions
{
MaxDegreeOfParallelism = selecteds.Count,
CancellationToken = ct,
};
@@ -570,6 +573,10 @@ public class SpeedtestService(Config config, Func<SpeedTestResult, Task> updateF
await clientSocket.ConnectAsync(endPoint, linkedCts.Token).ConfigureAwait(false);
responseTime = (int)timer.ElapsedMilliseconds;
}
catch
{
// Ignore
}
finally
{
timer.Stop();