From 797eff17b8a263adb81e11a8762e7f839358e885 Mon Sep 17 00:00:00 2001 From: Michel Zehnder Date: Tue, 7 Jun 2022 09:23:45 +0200 Subject: [PATCH] Improve cache behavior --- Custom Sensors/EXEXML/Get-SSLReport.psm1 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Custom Sensors/EXEXML/Get-SSLReport.psm1 b/Custom Sensors/EXEXML/Get-SSLReport.psm1 index 76873a5..e59d8d7 100644 --- a/Custom Sensors/EXEXML/Get-SSLReport.psm1 +++ b/Custom Sensors/EXEXML/Get-SSLReport.psm1 @@ -124,9 +124,11 @@ function Get-SSLReport { ) # Construct the URI part for Caching - if ($MaxCacheAgeHours -eq 0) - { + if ($MaxCacheAgeHours -eq 0) { + $MaxCacheAgeHours -eq 1 $cacheString = "&startNew=on" + } elseif ($MaxCacheAgeHours -lt 0) { + $cacheString = "" } else { $cacheString = "&fromCache=on&maxAge=$MaxCacheAgeHours" } @@ -155,10 +157,10 @@ function Get-SSLReport { { "IN_PROGRESS" { Write-Verbose "Scan is in progress. Waiting." - start-sleep -Seconds 10; return Get-SSLReport -serverName $serverName -maxCacheAge $maxCacheAge -timeoutSec $timeoutSec } + start-sleep -Seconds 10; return Get-SSLReport -serverName $serverName -maxCacheAge -1 -timeoutSec $timeoutSec } "DNS" { Write-Verbose "Scan is in progress. Waiting." - start-sleep -Seconds 10; return Get-SSLReport -serverName $serverName -maxCacheAge $maxCacheAge -timeoutSec $timeoutSec } + start-sleep -Seconds 10; return Get-SSLReport -serverName $serverName -maxCacheAge -1 -timeoutSec $timeoutSec } "ERROR" { throw $parsed.statusMessage }