web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Do Until loop freezing up
Power Automate
Unanswered

Do Until loop freezing up

(0) ShareShare
ReportReport
Posted on by 30

Hello, I am having an issue where when I encase a flow in a Do Until it freezes up and doesn't resolve.

 

What I'm trying to do is Query this HTTP API and return every result posted within the time frame by iterating the skip header with 'i' and limiting the API to return 1 result at a time. I do this to reduce the load as some of the results from the API can be quite hefty in terms of text size.

 

I then use a nested Apply Each to compare the API Query result against a list of vendors to see if the result needs to be added to a list to be reviewed at a later date.

 

I have tested this loop by forcing it to only loop once which works and resolves in a minute but when I increase the loop to 2 or more it freezes up and never resolves. Below I have run the flow that I will include in this post and you can see it ran for 27 minutes. I have run this overnight (at least 8 hours) and it never resolves so I assume it freezes.

WWNHooper_0-1673014402327.png

I'd just like to add that I'm relatively new to power automate so the issue may be down to my lack of experience, but any help on this would be amazing. Thank you.

Here is the entirety of the flow from start to finish.

WWNHooper_1-1673014854817.png

WWNHooper_2-1673014886291.png

WWNHooper_3-1673014950694.png

WWNHooper_5-1673015113098.png

WWNHooper_6-1673015209121.png

WWNHooper_7-1673015265017.png

WWNHooper_8-1673015300598.png

WWNHooper_9-1673015460217.png

WWNHooper_10-1673015608413.png

WWNHooper_0-1673016295317.png

 

WWNHooper_12-1673015698970.png

 

Categories:
I have the same question (0)
  • VictorIvanidze Profile Picture
    13,079 on at

    Hi @WWNHooper,

     

    can you create a test flow that will only execute the HTTP requests (no transformations etc). Will it freeze then?

    Also, could you show where do you set isFinish value?

  • WWNHooper Profile Picture
    30 on at

    Hi @VictorIvanidze, thanks for the quick response.

     

    isFinish is set in the success of the 'Check if cve date is before the start date' condition.

     

    I've created a new flow in the same environment as follows:

    WWNHooper_0-1673018514527.png

     

    This runs successfully and provides the following output:

    WWNHooper_4-1673019320469.png
     

    I then included the HTTP Get in a Do Until using i to iterate through API responses which also ran successfully:

    WWNHooper_2-1673019054893.png

    Is this what you wanted? I wasn't sure what you meant by no transformations.

     

  • VictorIvanidze Profile Picture
    13,079 on at

    Aha, great. Can you somehow check if isFinish really becomes true in you initial flow?

    Let's say set  isFinish to true after 10 loops?

  • Barret Profile Picture
    652 Most Valuable Professional on at

    If I were to guess, the problem is with your "check if cve date..." action. The left side of the comparison is using the formatDateTime function. That returns a string value. It will never be "less than" anything else as you can't use greater than/less than with strings, even when they represent a date. So your isFinish value never gets set to true. You will need to do a date comparison, or convert the two dates to ticks and then compare the ticks values.

  • WWNHooper Profile Picture
    30 on at

    Hi @barret, good point, I have rectified this by converting each side to a tick and comparing the resulting value.

     

    The left side of the comparison is now:

    ticks(formatDateTime(body('Convert_resultArr[0]_to_JSON')?['Modified'],'dd-MM-yyyy'))
    and the right side is now:
    ticks(formatDateTime(variables('timeStart'),'dd-MM-yyyy'))
     
    So correct me if I'm wrong but if the tick value of the returned JSON object is lower than the tick value of timeStart (meaning the JSON dateis earlier than the timeStart date) then the condition should be met.
    WWNHooper_0-1673025651325.png

    I have run the flow and will reply to this post with the result soon.

  • WWNHooper Profile Picture
    30 on at

    Hi Victor, following on from my reply to @barret, I've casted the dates to ticks in the condition. I will add an Or to the  condition as well to end the loop after 10 iterations like so (I haven't used an Or in a condition yet so I hope this is the correct way):

    WWNHooper_1-1673026057678.png

    Again I have run the flow and will reply to this post when it has either completed or taken to long.

  • WWNHooper Profile Picture
    30 on at

    @VictorIvanidze 

    Ok, so that ran successfully. Here are the results of the Do Until:

    WWNHooper_2-1673029040928.png

    WWNHooper_3-1673029099823.png

    As you can see, it ran 11 times as 'i' started at 0 and ended on 10.

     

    The other version I created with @barret s suggestion is still running.

     

  • VictorIvanidze Profile Picture
    13,079 on at

    Well, concentrate on barret's version then. We made sure that HTTP requests are working properly.

  • WWNHooper Profile Picture
    30 on at

    Ok, sounds good. The other flow is still running, I guess I'll let it go over the weekend and see what happens.

     

    One thing that troubles me is that the version that worked (with the 10 iterations) took 44 minutes. Is this normal for a flow of this size? Is there any obvious way I can reduce the time it takes to run the flow?

     

    As I said in the original post I'm quite new to Power Automate so apologies if any of this is common knowledge.

  • Barret Profile Picture
    652 Most Valuable Professional on at

    It depends entirely on what your flow is doing. You'll have to spend some time studying the run history to determine where the slow parts are occurring. There are definitely some oddities in what you're reporting. For instance, in the screenshot you shared above, the 11 iterations took 44 minutes. But iteration 11 as you show in the screenshot appears to have only taken a couple of seconds to run. That would indicate that it's getting stuck on something somewhere. Whatever the delay is, you'll have to wade through those run logs to find it. Certainly, the steps you show with things like converting text, doing comparisons, and so forth, should not take an extra long amount of time to accomplish. You can also take a look at any loops (apply_to_each) and determine if you can design them to run in parallel instead of consecutively. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 378 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 305 Super User 2025 Season 2

#3
Expiscornovus Profile Picture

Expiscornovus 155 Most Valuable Professional

Last 30 days Overall leaderboard