https://github.com/2dust/v2rayN/issues/5915
This commit is contained in:
2dust
2024-10-26 09:55:22 +08:00
parent 1106fd8cf1
commit 6e35a260e8
3 changed files with 29 additions and 31 deletions
@@ -96,7 +96,7 @@ namespace ServiceLib.ViewModels
private async Task Init()
{
await ProxiesReload();
await DelayTestTask();
DelayTestTask();
}
private async Task DoRulemodeSelected(bool c)
@@ -434,25 +434,29 @@ namespace ServiceLib.ViewModels
public async Task DelayTestTask()
{
var lastTime = DateTime.Now;
Task.Run(async () =>
{
while (true)
{
await Task.Delay(1000 * 60);
Observable.Interval(TimeSpan.FromSeconds(60))
.Subscribe(async x =>
{
if (!(AutoRefresh && _config.UiItem.ShowInTaskbar && _config.IsRunningCore(ECoreType.sing_box)))
{
return;
}
var dtNow = DateTime.Now;
if (_config.ClashUIItem.ProxiesAutoDelayTestInterval > 0)
{
if ((dtNow - lastTime).Minutes % _config.ClashUIItem.ProxiesAutoDelayTestInterval == 0)
{
await ProxiesDelayTest();
lastTime = dtNow;
}
Task.Delay(1000).Wait();
}
});
if (!(AutoRefresh && _config.UiItem.ShowInTaskbar && _config.IsRunningCore(ECoreType.sing_box)))
{
continue;
}
if (_config.ClashUIItem.ProxiesAutoDelayTestInterval <= 0)
{
continue;
}
var dtNow = DateTime.Now;
if ((dtNow - lastTime).Minutes % _config.ClashUIItem.ProxiesAutoDelayTestInterval != 0)
{
continue;
}
await ProxiesDelayTest();
lastTime = dtNow;
}
});
}
#endregion task