From f136ad35ea70f25bf5f0e145aac22e15ce9714d4 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Mon, 19 Aug 2024 02:24:30 +0200 Subject: [PATCH] Streamline OneShot task handler --- scripts/Common/Scripts/Operations.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/Common/Scripts/Operations.ps1 b/scripts/Common/Scripts/Operations.ps1 index c3e07bd3..ee0d703b 100644 --- a/scripts/Common/Scripts/Operations.ps1 +++ b/scripts/Common/Scripts/Operations.ps1 @@ -104,8 +104,10 @@ $null = New-Module { }; Write-EventLog -LogName $logName -Source $logName -EventId $oneShotTrigger -Message "Starting OneShot task ``$(Get-OneShotTask)``…"; - Remove-Event -EventIdentifier (Wait-Event -SourceIdentifier $identifier).EventIdentifier; - $null = Wait-Event -SourceIdentifier $identifier; + + for ($i = 0; $i -lt 2; $i++) { + Remove-Event -EventIdentifier (Wait-Event -SourceIdentifier $identifier).EventIdentifier; + } }; Set-Stage $currentStage;