From 3a647bce511d5baa953ce7b2b6d55ee89b9c7a5e Mon Sep 17 00:00:00 2001 From: "Leo Berezovskiy (448981)" Date: Wed, 15 Mar 2023 08:39:00 -0700 Subject: [PATCH] Break out of infinite loop --- SDNExpress/scripts/SDNExpressModule.psm1 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/SDNExpress/scripts/SDNExpressModule.psm1 b/SDNExpress/scripts/SDNExpressModule.psm1 index 03cda498..a2d05706 100644 --- a/SDNExpress/scripts/SDNExpressModule.psm1 +++ b/SDNExpress/scripts/SDNExpressModule.psm1 @@ -514,8 +514,11 @@ General notes return } - write-sdnexpresslog ("Checking for REST response.") + [Int] $Timeout = 1200 # 20 minutes + write-sdnexpresslog ("Checking for REST response for up to $Timeout seconds.") $NotResponding = $true + $endtime = (get-date).ticks + ($timeout * 10000000) + while ($NotResponding) { try { $NotResponding = $false @@ -527,6 +530,12 @@ General notes sleep 10 $NotResponding = $true } + + if ((get-date).ticks -gt $endtime) { + $message = "Failed to get REST response after $timeout seconds timeout." + write-sdnexpresslog $message + throw $message + } } Write-SDNExpressLog "Sleep 60 to allow controller time to settle down."