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

@ -98,7 +98,7 @@ namespace CriticalPathAnalyzer.Server.Tool {
int iters = 0;
while (queue.TryDequeue(out ClusterNode node)) {
iters++;
if (iters > 1000) {
if (iters > 10000) {
logger.Error("Infinite iterations");
break;
}
@ -129,6 +129,8 @@ namespace CriticalPathAnalyzer.Server.Tool {
loopingNodes.Add(node.Index);
loopingNodes.Add(nextNode.Index);
// 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;
}

Loading…
Cancel
Save