Skip to content

Commit

Permalink
优化执行检测订阅可能卡住的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
aiqinxuancai committed Aug 2, 2024
1 parent b26e3c8 commit d8bcd50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Aria2Fast/Service/SubscriptionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ public async Task CheckSubscriptionOne(SubscriptionModel subscription)
var client = new HttpClient(handler);

// 注意这里的GET请求的地址需要替换为你需要请求的地址
client.Timeout = TimeSpan.FromSeconds(20);
var response = client.GetAsync(url).Result;


Expand All @@ -416,7 +417,10 @@ public async Task CheckSubscriptionOne(SubscriptionModel subscription)
}
else
{
reader = XmlReader.Create(url);
var client = new HttpClient();
client.Timeout = TimeSpan.FromSeconds(20);
var response = client.GetAsync(url).Result;
reader = XmlReader.Create(response.Content.ReadAsStreamAsync().Result);
feed = SyndicationFeed.Load(reader);
reader.Close();
}
Expand Down
4 changes: 2 additions & 2 deletions Aria2Fast/Utils/SimpleLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class SimpleLogger
private readonly string datetimeFormat;
private readonly string logFilename;


/// <summary>
/// Initiate an instance of SimpleLogger class constructor.
/// If log file does not exist, it will be created automatically.
Expand Down Expand Up @@ -86,7 +87,6 @@ public void Info(string text, params object[] args)
WriteFormattedLog(LogLevel.INFO, string.Format(text, args));
}


/// <summary>
/// Log a TRACE message
/// </summary>
Expand Down Expand Up @@ -171,4 +171,4 @@ private enum LogLevel
FATAL
}
}
}
}

0 comments on commit d8bcd50

Please sign in to comment.