重构了运行逻辑。上下文使用对象池封装,节点方法调用时间传递CancellationTokenSource用来中止任务

This commit is contained in:
fengjiayi
2025-03-20 22:54:10 +08:00
parent 2168c5ec66
commit 9941f24c5d
27 changed files with 830 additions and 621 deletions

View File

@@ -29,7 +29,9 @@ namespace Serein.Workbench.Node.ViewModel
{
try
{
var result = await NodeModel.ExecutingAsync(new Library.DynamicContext(nodeModel.Env));
var cts = new CancellationTokenSource();
var result = await NodeModel.ExecutingAsync(new Library.DynamicContext(nodeModel.Env), cts.Token);
cts.Cancel();
SereinEnv.WriteLine(InfoType.INFO, result?.ToString());
}
catch (Exception ex)