mirror of
https://github.com/2dust/v2rayN.git
synced 2026-09-30 10:32:07 +03:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user