修复进度上下文中可能死锁的进度更新方法

This commit is contained in:
陈梓阳 2024-12-31 16:48:05 +08:00
parent 8037fc74de
commit 27ea80d359

View File

@ -59,12 +59,11 @@ public class ProcessContext
public void AddTableInput(string table, int count) public void AddTableInput(string table, int count)
{ {
if (!_tableProgress.TryAdd(table, (input: count, output: 0))) _tableProgress.AddOrUpdate(table, (input: count, output: 0), (k, tuple) =>
{ {
var tuple = _tableProgress[table]; tuple.output += count;
tuple.input += count; return tuple;
_tableProgress[table] = tuple; });
}
} }
public void AddTableOutput(string table, int count) public void AddTableOutput(string table, int count)