mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-04-04 15:26:34 +08:00
重构了运行逻辑。上下文使用对象池封装,节点方法调用时间传递CancellationTokenSource用来中止任务
This commit is contained in:
@@ -15,12 +15,13 @@ namespace Serein.NodeFlow.Model
|
||||
{
|
||||
}
|
||||
|
||||
public override async Task<object> ExecutingAsync(IDynamicContext context)
|
||||
public override async Task<object?> ExecutingAsync(IDynamicContext context, CancellationToken token)
|
||||
{
|
||||
if (token.IsCancellationRequested) return null;
|
||||
if(Adapter is null)
|
||||
{
|
||||
|
||||
var result = await base.ExecutingAsync(context);
|
||||
var result = await base.ExecutingAsync(context, token);
|
||||
if (result is IEmbeddedContent adapter)
|
||||
{
|
||||
this.Adapter = adapter;
|
||||
@@ -39,7 +40,7 @@ namespace Serein.NodeFlow.Model
|
||||
iflowContorl.OnExecuting(data);
|
||||
}
|
||||
|
||||
return Task.FromResult<object?>(null);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user