更改了日志输出,更改了ChannelFlowTrigger存在的内存泄漏(取消超时机制)

This commit is contained in:
fengjiayi
2024-09-21 10:06:44 +08:00
parent a1ecd259dd
commit 3537a49784
15 changed files with 624 additions and 304 deletions

View File

@@ -9,6 +9,7 @@ using Serein.NodeFlow.Model;
using Serein.NodeFlow.Tool;
using System.Collections.Concurrent;
using System.Reflection;
using System.Xml.Linq;
using static Serein.NodeFlow.FlowStarter;
namespace Serein.NodeFlow
@@ -196,9 +197,20 @@ namespace Serein.NodeFlow
}
public void Exit()
{
foreach (var node in Nodes.Values)
{
if (typeof(IDisposable).IsAssignableFrom(node?.FlowData?.GetType()) && node.FlowData is IDisposable disposable)
{
disposable?.Dispose();
}
node!.FlowData = null;
}
ChannelFlowInterrupt?.CancelAllTasks();
flowStarter?.Exit();
OnFlowRunComplete?.Invoke(new FlowEventArgs());
GC.Collect();
}
/// <summary>
@@ -452,7 +464,9 @@ namespace Serein.NodeFlow
for (int i = 0; i < pnc.Value.Count; i++)
{
NodeModelBase? pNode = pnc.Value[i];
pNode.SuccessorNodes[pCType].RemoveAt(i);
//pNode.SuccessorNodes[pCType].RemoveAt(i);
pNode.SuccessorNodes[pCType].Remove(pNode);
OnNodeConnectChange?.Invoke(new NodeConnectChangeEventArgs(pNode.Guid,
remoteNode.Guid,
pCType,