Skip to content

Commit ff2e443

Browse files
committed
fix: correct non-deterministic error in orchestrator
1 parent 2e867ef commit ff2e443

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

Modules/CippEntrypoints/CippEntrypoints.psm1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,14 @@ function Receive-CippOrchestrationTrigger {
255255
Write-Information "Durable Mode: $DurableMode"
256256

257257
$RetryOptions = New-DurableRetryOptions @DurableRetryOptions
258-
if (!$OrchestratorInput.Batch -or ($OrchestratorInput.Batch | Measure-Object).Count -eq 0 -and $OrchestratorInput.QueueFunction) {
259-
$Batch = (Invoke-ActivityFunction -FunctionName 'CIPPActivityFunction' -Input $OrchestratorInput.QueueFunction -ErrorAction Stop) | Where-Object { $null -ne $_.FunctionName }
260-
} elseif ($OrchestratorInput.Batch) {
258+
259+
$HasBatch = $OrchestratorInput.Batch -and @($OrchestratorInput.Batch).Count -gt 0
260+
$HasQueueFunction = $null -ne $OrchestratorInput.QueueFunction -and $OrchestratorInput.QueueFunction -ne ''
261+
262+
if ($HasBatch) {
261263
$Batch = $OrchestratorInput.Batch | Where-Object { $null -ne $_.FunctionName }
264+
} elseif ($HasQueueFunction) {
265+
$Batch = (Invoke-ActivityFunction -FunctionName 'CIPPActivityFunction' -Input $OrchestratorInput.QueueFunction -ErrorAction Stop) | Where-Object { $null -ne $_.FunctionName }
262266
} else {
263267
Write-Information 'No batch or queue function provided to orchestrator input'
264268
$Batch = @()

0 commit comments

Comments
 (0)