Fix Observatory (#7437)

* Enables concurrency for observatory

* Adds burst observatory for least load balancer
This commit is contained in:
DHR60 2025-06-15 14:41:47 +08:00 committed by GitHub
parent 2056377f55
commit 9ddf0b42e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1366,16 +1366,32 @@ public class CoreConfigV2rayService
private async Task<int> GenBalancer(V2rayConfig v2rayConfig, EMultipleLoad multipleLoad)
{
if (multipleLoad is EMultipleLoad.LeastLoad or EMultipleLoad.LeastPing)
if (multipleLoad == EMultipleLoad.LeastPing)
{
var observatory = new Observatory4Ray
{
subjectSelector = [Global.ProxyTag],
probeUrl = AppHandler.Instance.Config.SpeedTestItem.SpeedPingTestUrl,
probeInterval = "3m"
probeInterval = "3m",
enableConcurrency = true,
};
v2rayConfig.observatory = observatory;
}
else if (multipleLoad == EMultipleLoad.LeastLoad)
{
var burstObservatory = new BurstObservatory4Ray
{
subjectSelector = [Global.ProxyTag],
pingConfig = new()
{
destination = AppHandler.Instance.Config.SpeedTestItem.SpeedPingTestUrl,
interval = "5m",
timeout = "30s",
sampling = 2,
}
};
v2rayConfig.burstObservatory = burstObservatory;
}
var strategyType = multipleLoad switch
{
EMultipleLoad.Random => "random",