1. 修改了FlowResult的创建方式,新增了IsSuccess与Message,为后续进行流程日志追踪准备。

2. 修复了删除节点时,没有正确消除与之相关的参数获取关系。
3. IFlowNode新增了StartFlowAsync方法。
4. Library项目中FlowNodeExtension拓展类转移到了NodeFlow项目中。
5.  修改了Script自定义参数保存,对参数类型、返回值类型进行保存。
6. Library.Utils.BenchmarkHelpter中添加了Task、Task<>的重载方法。
7. NodeFlow项目中,FlowEnvironment默认使用通过NewtonsoftJson实现的JSON门户类。
8. NodeFlow项目中,FlowControl缓存了 FlowWorkOptions 选项实体,并且对于 FlowWorkManagement 进行了池化管理(但后续的项目中考虑重构流程任务运行时)。
This commit is contained in:
fengjiayi
2025-07-30 11:29:12 +08:00
parent 8dc7f5dd9b
commit 48289dae11
27 changed files with 965 additions and 106 deletions

View File

@@ -120,32 +120,28 @@ namespace Serein.NodeFlow.Model.Nodes
/// <returns></returns>
public override async Task<FlowResult> ExecutingAsync(IFlowContext context, CancellationToken token)
{
if (token.IsCancellationRequested) return new FlowResult(this.Guid, context);
if (token.IsCancellationRequested) return FlowResult.Fail(this.Guid, context, "流程已通过token取消");
if (string.IsNullOrEmpty(KeyName))
{
context.NextOrientation = ConnectionInvokeType.IsError;
SereinEnv.WriteLine(InfoType.ERROR, $"全局数据的KeyName不能为空[{this.Guid}]");
return new FlowResult(this.Guid, context);
return FlowResult.Fail(this.Guid, context, $"全局数据的KeyName不能为空[{this.Guid}]");
}
if (DataNode is null)
{
context.NextOrientation = ConnectionInvokeType.IsError;
SereinEnv.WriteLine(InfoType.ERROR, $"全局数据节点没有设置数据来源[{this.Guid}]");
return new FlowResult(this.Guid, context);
return FlowResult.Fail(this.Guid, context, $"全局数据节点没有设置数据来源[{this.Guid}]");
}
try
var result = await DataNode.ExecutingAsync(context, token);
if (result.IsSuccess)
{
var result = await DataNode.ExecutingAsync(context, token);
SereinEnv.AddOrUpdateFlowGlobalData(KeyName, result.Value);
return result;
}
catch (Exception ex)
else
{
context.NextOrientation = ConnectionInvokeType.IsError;
context.ExceptionOfRuning = ex;
return new FlowResult(this.Guid, context);
return FlowResult.Fail(this.Guid, context, $"全局数据节点[{this.Guid}]执行失败,原因:{result.Message}。");
}
}