mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-20 12:15:00 +03:00
Optimizing Task Code
This commit is contained in:
@@ -7,9 +7,9 @@ namespace ServiceLib.Handler
|
||||
private static readonly Lazy<ClashApiHandler> instance = new(() => new());
|
||||
public static ClashApiHandler Instance => instance.Value;
|
||||
|
||||
private static readonly string _tag = "ClashApiHandler";
|
||||
private Dictionary<string, ProxiesItem>? _proxies;
|
||||
public Dictionary<string, object> ProfileContent { get; set; }
|
||||
private static readonly string _tag = "ClashApiHandler";
|
||||
|
||||
public async Task<Tuple<ClashProxies, ClashProviders>?> GetClashProxiesAsync(Config config)
|
||||
{
|
||||
@@ -54,7 +54,7 @@ namespace ServiceLib.Handler
|
||||
return;
|
||||
}
|
||||
lstProxy = new List<ClashProxyModel>();
|
||||
foreach (KeyValuePair<string, ProxiesItem> kv in _proxies)
|
||||
foreach (var kv in _proxies)
|
||||
{
|
||||
if (Global.notAllowTestType.Contains(kv.Value.type.ToLower()))
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace ServiceLib.Handler
|
||||
//Execute once 20 minute
|
||||
if (numOfExecuted % 20 == 0)
|
||||
{
|
||||
Logging.SaveLog("Execute save config");
|
||||
//Logging.SaveLog("Execute save config");
|
||||
|
||||
await ConfigHandler.SaveConfig(config);
|
||||
await ProfileExHandler.Instance.SaveTo();
|
||||
@@ -35,7 +35,7 @@ namespace ServiceLib.Handler
|
||||
//Execute once 1 hour
|
||||
if (numOfExecuted % 60 == 0)
|
||||
{
|
||||
Logging.SaveLog("Execute delete expired files");
|
||||
//Logging.SaveLog("Execute delete expired files");
|
||||
|
||||
FileManager.DeleteExpiredFiles(Utils.GetBinConfigPath(), DateTime.Now.AddHours(-1));
|
||||
FileManager.DeleteExpiredFiles(Utils.GetLogPath(), DateTime.Now.AddMonths(-1));
|
||||
@@ -72,7 +72,7 @@ namespace ServiceLib.Handler
|
||||
updateFunc?.Invoke(success, msg);
|
||||
if (success)
|
||||
{
|
||||
Logging.SaveLog("Update subscription end" + msg);
|
||||
Logging.SaveLog($"Update subscription end. {msg}");
|
||||
}
|
||||
});
|
||||
item.UpdateTime = updateTime;
|
||||
|
||||
Reference in New Issue
Block a user