Skip to content

Commit ca33847

Browse files
committed
move scheduler running state to inside durable
1 parent e0e6022 commit ca33847

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Push-ExecScheduledCommand.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ function Push-ExecScheduledCommand {
1313
$Tenant = $Item.Parameters.TenantFilter ?? $Item.TaskInfo.Tenant
1414
$TenantInfo = Get-Tenants -TenantFilter $Tenant
1515

16+
$null = Update-AzDataTableEntity -Force @Table -Entity @{
17+
PartitionKey = $task.PartitionKey
18+
RowKey = $task.RowKey
19+
TaskState = 'Running'
20+
}
21+
1622
$Function = Get-Command -Name $Item.Command
1723
if ($null -eq $Function) {
1824
$Results = "Task Failed: The command $($Item.Command) does not exist."
@@ -23,6 +29,7 @@ function Push-ExecScheduledCommand {
2329
Results = "$Results"
2430
TaskState = $State
2531
}
32+
2633
Write-LogMessage -API 'Scheduler_UserTasks' -tenant $Tenant -tenantid $TenantInfo.customerId -message "Failed to execute task $($task.Name): The command $($Item.Command) does not exist." -sev Error
2734
return
2835
}

Modules/CIPPCore/Public/Entrypoints/Orchestrator Functions/Start-UserTasksOrchestrator.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function Start-UserTasksOrchestrator {
2121
PartitionKey = $task.PartitionKey
2222
RowKey = $task.RowKey
2323
ExecutedTime = "$currentUnixTime"
24-
TaskState = 'Running'
24+
TaskState = 'Planned'
2525
}
2626
$task.Parameters = $task.Parameters | ConvertFrom-Json -AsHashtable
2727
$task.AdditionalProperties = $task.AdditionalProperties | ConvertFrom-Json

0 commit comments

Comments
 (0)