Replace null PegAddress with Empty

master
D4VID 7 months ago
parent 20d722eb4e
commit 2dce593d9b

@ -13,8 +13,8 @@ namespace CriticalPathAnalyzer.Client.Tool {
public class CriticalPathAnalyzerTool { public class CriticalPathAnalyzerTool {
private static ILogicLogger _logger; private static ILogicLogger _logger;
private static PegAddress? _startPegAddress; private static PegAddress _startPegAddress = PegAddress.Empty;
private static PegAddress? _endPegAddress; private static PegAddress _endPegAddress = PegAddress.Empty;
private static Guid _currentRequestGuid = Guid.NewGuid(); private static Guid _currentRequestGuid = Guid.NewGuid();
private static AnalyzePathResponse _response; private static AnalyzePathResponse _response;
@ -24,8 +24,8 @@ namespace CriticalPathAnalyzer.Client.Tool {
} }
public static void Clear() { public static void Clear() {
_startPegAddress = null; _startPegAddress = PegAddress.Empty;
_endPegAddress = null; _endPegAddress = PegAddress.Empty;
PathHighLighter.RemoveHighLighting(); PathHighLighter.RemoveHighLighting();
} }
@ -86,7 +86,7 @@ namespace CriticalPathAnalyzer.Client.Tool {
} }
private static void CalculateCriticalPath() { private static void CalculateCriticalPath() {
if (_startPegAddress == null || _endPegAddress == null) { if (_startPegAddress.IsEmpty() || _endPegAddress.IsEmpty()) {
_logger.Error("Invalid pegs"); _logger.Error("Invalid pegs");
return; return;
} }
@ -94,8 +94,8 @@ namespace CriticalPathAnalyzer.Client.Tool {
_currentRequestGuid = Guid.NewGuid(); _currentRequestGuid = Guid.NewGuid();
Instances.SendData.Send(new AnalyzePathRequest { Instances.SendData.Send(new AnalyzePathRequest {
RequestGuid = _currentRequestGuid, RequestGuid = _currentRequestGuid,
StartPegAddress = _startPegAddress.Value, StartPegAddress = _startPegAddress,
EndPegAddress = _endPegAddress.Value, EndPegAddress = _endPegAddress,
}); });
} }

@ -98,7 +98,7 @@ namespace CriticalPathAnalyzer.Server.Tool {
int iters = 0; int iters = 0;
while (queue.TryDequeue(out ClusterNode node)) { while (queue.TryDequeue(out ClusterNode node)) {
iters++; iters++;
if (iters > 1000) { if (iters > 10000) {
logger.Error("Infinite iterations"); logger.Error("Infinite iterations");
break; break;
} }
@ -129,6 +129,8 @@ namespace CriticalPathAnalyzer.Server.Tool {
loopingNodes.Add(node.Index); loopingNodes.Add(node.Index);
loopingNodes.Add(nextNode.Index); loopingNodes.Add(nextNode.Index);
// already been here - there is a cycle // already been here - there is a cycle
// TODO: this doesn't work - if cluster A is updated by cluster B,
// TODO: and cluster B is updated by clusters C and D, it detects a cycle where isn't one
continue; continue;
} }

Loading…
Cancel
Save