mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-07 02:00:47 +08:00
修改了logwindows输出,避免高频输出时卡死。修改了流程运行上下文,使节点具备终止分支运行的能力。
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using Serein.Library.Api;
|
||||
using Serein.Library.Enums;
|
||||
using Serein.Library.Utils;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -17,12 +19,63 @@ namespace Serein.Library.Framework.NodeFlow
|
||||
{
|
||||
// SereinIoc = sereinIoc;
|
||||
Env = flowEnvironment;
|
||||
RunState = RunState.Running;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 运行环境
|
||||
/// </summary>
|
||||
public IFlowEnvironment Env { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 运行状态
|
||||
/// </summary>
|
||||
public RunState RunState { get; set; } = RunState.NoStart;
|
||||
/// <summary>
|
||||
/// 每个上下文分别存放节点的当前数据
|
||||
/// </summary>
|
||||
private readonly ConcurrentDictionary<string, object> dictNodeFlowData = new ConcurrentDictionary<string, object>();
|
||||
|
||||
/// <summary>
|
||||
/// 获取节点当前数据
|
||||
/// </summary>
|
||||
/// <param name="nodeGuid"></param>
|
||||
/// <returns></returns>
|
||||
public object GetFlowData(string nodeGuid)
|
||||
{
|
||||
if (dictNodeFlowData.TryGetValue(nodeGuid, out var data))
|
||||
{
|
||||
return data;
|
||||
}
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加或更新当前节点数据
|
||||
/// </summary>
|
||||
/// <param name="nodeGuid">节点Guid</param>
|
||||
/// <param name="flowData">新的数据</param>
|
||||
public void AddOrUpdate(string nodeGuid, object flowData)
|
||||
{
|
||||
// this.dictNodeFlowData.TryGetValue(nodeGuid, out var oldFlowData);
|
||||
this.dictNodeFlowData[nodeGuid] = flowData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 结束流程
|
||||
/// </summary>
|
||||
public void EndCurrentBranch()
|
||||
{
|
||||
this.dictNodeFlowData?.Clear();
|
||||
RunState = RunState.Completion;
|
||||
}
|
||||
|
||||
// public NodeRunCts NodeRunCts { get; set; }
|
||||
// public ISereinIOC SereinIoc { get; }
|
||||
public IFlowEnvironment Env { get; }
|
||||
|
||||
//public Task CreateTimingTask(Action action, int time = 100, int count = -1)
|
||||
//{
|
||||
// if(NodeRunCts == null)
|
||||
|
||||
Reference in New Issue
Block a user