2

I have a Logic App with an Until action to keep looping until a condition is met (in this case when the Azure Container Instance has the state 'Terminated'). I've changed the limit 'Count' to 600. I left the 'Timeout' on the default value (PT1H). Amongst other actions the Until action contains a Delay action which I've set to 1 second. So in theory the math would be: 600 x 1 sec = 10 minutes max. Right? I triggered the Logic App late in the afternoon and went home. Checked the run when I got home to find out it ran for 26 minutes! See screenshot:

Until action in Logic App

So, can anyone explain this? Thanks in advance for replying.

Update #1: For Each info The For Each inside the Until loops through the Containers in the group (which is just 1 Container) and puts the state of the containers in the variable (which is used for the condition of the Until). That's it.

Update #2: All actions Logic App All the actions of the Logic App:

Logic App actions part 1 Logic App actions part 2 Logic App actions part 3

note: For the keen eyed, I'm indeed not deleting the container group yet. For debugging purposes.

Update #3: Initialize Variable info

Initialize Variable action

note: This "state" is the state of the container group which is simply used to initially fill the variable. In the Until loop it's filled with state of the container instance inside the group.

Update #4: Get Properties in For Each Get Properties For Each

note: Asked in the chat.

Danny van der Kraan
  • 5,344
  • 6
  • 31
  • 41

1 Answers1

0

For your issue, you need to know that when the action that creates the container group is finished, the container group may not in the terminate state, but the action is finished so that the state will persist and not change any more.

So you need to get the state all the time in your loop. The right sequence for the container group should like this:

  1. create the container group;
  2. initialize the variable currentState;
  3. create the loop, your until setting condition is right, but you need to put the action that gets the property of the container group in your for-each loop. So inside the for-each, get the property, set the variable with the state, then delay.
Charles Xu
  • 29,862
  • 2
  • 22
  • 39