Skip to content

Commit

Permalink
fix: Added the -FollowNextPageLink parameter to the `Get-AzLogicApp…
Browse files Browse the repository at this point in the history
…RunHistory` command (#391)

Co-authored-by: Stijn Moreels <[email protected]>
Co-authored-by: Pim Simons <[email protected]>
  • Loading branch information
3 people authored May 26, 2023
1 parent d11ff7c commit df1d08b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ param(
[Parameter(Mandatory = $true)][string] $LogicAppName = $(throw "Name of the logic app is required")
)

try{
$runs = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $LogicAppName |
try {
$runs = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $LogicAppName -FollowNextPageLink |
Where-Object {$_.Status -eq 'Running'}

foreach ($run in $runs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ function ExecuteCheckType() {
}

try {
$RunningRunsCount = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $logicApp -ErrorAction Stop | Where-Object Status -eq "Running" | Measure-Object | ForEach-Object { $_.Count }
$WaitingRunsCount = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $logicApp -ErrorAction Stop | Where-Object Status -eq "Waiting" | Measure-Object | ForEach-Object { $_.Count }
$RunningRunsCount = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $logicApp -FollowNextPageLink -ErrorAction Stop | Where-Object Status -eq "Running" | Measure-Object | ForEach-Object { $_.Count }
$WaitingRunsCount = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $logicApp -FollowNextPageLink -ErrorAction Stop | Where-Object Status -eq "Waiting" | Measure-Object | ForEach-Object { $_.Count }
if ($RunningRunsCount -ne 0 -and $WaitingRunsCount -ne 0) {
while ($RunningRunsCount -ne 0 -and $WaitingRunsCount -ne 0) {
Write-Verbose "Azure Logic App '$logicApp' has Running and/or Waiting Runs, waiting 10 seconds and checking again..."
Write-Debug "Number of running runs: $RunningRunsCount"
Write-Debug "Number of waiting runs: $WaitingRunsCount"
Start-Sleep -Second 10
$RunningRunsCount = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $logicApp -ErrorAction Stop | Where-Object Status -eq "Running" | Measure-Object | ForEach-Object { $_.Count }
$WaitingRunsCount = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $logicApp -ErrorAction Stop | Where-Object Status -eq "Waiting" | Measure-Object | ForEach-Object { $_.Count }
$RunningRunsCount = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $logicApp -FollowNextPageLink -ErrorAction Stop | Where-Object Status -eq "Running" | Measure-Object | ForEach-Object { $_.Count }
$WaitingRunsCount = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $logicApp -FollowNextPageLink -ErrorAction Stop | Where-Object Status -eq "Waiting" | Measure-Object | ForEach-Object { $_.Count }
if ($RunningRunsCount -eq 0 -and $WaitingRunsCount -eq 0) {
Write-Verbose "Found no more waiting or running runs for Azure Logic App '$logicApp', executing stopType for Logic App"
ExecuteStopType -resourceGroupName $ResourceGroupName -LogicAppName $logicApp -stopType $batch.stopType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ param(

try{
if ($EndTime) {
$runs = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $LogicAppName |
$runs = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $LogicAppName -FollowNextPageLink |
Where-Object {$_.Status -eq 'Failed' -and $_.StartTime -ge $StartTime -and $_.EndTime -le $EndTime}
} else {
$runs = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $LogicAppName |
$runs = Get-AzLogicAppRunHistory -ResourceGroupName $ResourceGroupName -Name $LogicAppName -FollowNextPageLink |
Where-Object {$_.Status -eq 'Failed' -and $_.StartTime -ge $StartTime}
}

Expand Down

0 comments on commit df1d08b

Please sign in to comment.