mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-09 06:59:53 +03:00
Fix async (#10218)
* Fix async * Fix async for statistics * Try fix pac async * Fix
This commit is contained in:
@@ -30,12 +30,7 @@ public partial class ClashConnectionsViewModel : MyReactiveObject
|
||||
cancelDisposable.DisposeWith(disposables);
|
||||
var token = cancelDisposable.Token;
|
||||
|
||||
Task.Factory.StartNew(
|
||||
async () => await GetClashConnectionsTask(token),
|
||||
token,
|
||||
TaskCreationOptions.LongRunning,
|
||||
TaskScheduler.Default
|
||||
);
|
||||
Task.Run(() => GetClashConnectionsTask(token));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -129,9 +124,9 @@ public partial class ClashConnectionsViewModel : MyReactiveObject
|
||||
try
|
||||
{
|
||||
var numOfExecuted = 1;
|
||||
while (!token.IsCancellationRequested)
|
||||
using var timer = new PeriodicTimer(TimeSpan.FromSeconds(1));
|
||||
while (await timer.WaitForNextTickAsync(token).ConfigureAwait(false))
|
||||
{
|
||||
await Task.Delay(1000, token);
|
||||
numOfExecuted++;
|
||||
if (!(AutoRefresh && AppManager.Instance.ShowInTaskbar &&
|
||||
AppManager.Instance.IsRunningCore(ECoreType.sing_box)))
|
||||
|
||||
@@ -61,12 +61,7 @@ public partial class ClashProxiesViewModel : MyReactiveObject
|
||||
cancelDisposable.DisposeWith(disposables);
|
||||
var token = cancelDisposable.Token;
|
||||
|
||||
Task.Factory.StartNew(
|
||||
async () => await GetClashProxiesTask(token),
|
||||
token,
|
||||
TaskCreationOptions.LongRunning,
|
||||
TaskScheduler.Default
|
||||
);
|
||||
Task.Run(() => GetClashProxiesTask(token));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -113,9 +108,9 @@ public partial class ClashProxiesViewModel : MyReactiveObject
|
||||
try
|
||||
{
|
||||
var numOfExecuted = 1;
|
||||
while (!token.IsCancellationRequested)
|
||||
using var timer = new PeriodicTimer(TimeSpan.FromSeconds(1));
|
||||
while (await timer.WaitForNextTickAsync(token).ConfigureAwait(false))
|
||||
{
|
||||
await Task.Delay(1000, token);
|
||||
numOfExecuted++;
|
||||
if (!(AutoRefresh && AppManager.Instance.ShowInTaskbar &&
|
||||
AppManager.Instance.IsRunningCore(ECoreType.sing_box)))
|
||||
|
||||
Reference in New Issue
Block a user