mirror of
https://github.com/real-zony/ZonyLrcToolsX.git
synced 2026-11-24 03:37:47 +08:00
fix(cli): 解密命令的 WarpTask 补上释放
与第一个提交修掉的下载循环同一处泄漏:WarpTask.Dispose 会先取消令牌,再同步 等待所有信号量槽位释放。漏掉 using 就把这个等待丢给了终结器线程。
This commit is contained in:
1 parent
201b1abf40
commit
fdcc33b1d5
1 file changed
+3
-1
@@ -47,7 +47,9 @@ namespace ZonyLrcTools.Cli.Commands.SubCommand
|
|||||||
|
|
||||||
_logger.LogInformation($"扫描完成,共 {files.Count} 个文件,准备转换。");
|
_logger.LogInformation($"扫描完成,共 {files.Count} 个文件,准备转换。");
|
||||||
|
|
||||||
var wrapTask = new WarpTask(4);
|
// WarpTask.Dispose 会取消令牌并同步等待所有槽位释放,漏掉 using 就会
|
||||||
|
// 泄漏 CTS/Semaphore,并让终结器线程去做阻塞等待。
|
||||||
|
using var wrapTask = new WarpTask(4);
|
||||||
var tasks = files.Select(path => wrapTask.RunAsync(async () =>
|
var tasks = files.Select(path => wrapTask.RunAsync(async () =>
|
||||||
{
|
{
|
||||||
_logger.LogInformation($"开始转换文件:{path}");
|
_logger.LogInformation($"开始转换文件:{path}");
|
||||||
|
|||||||
Reference in new issue
Block a user