Terminate the current iteration if it is taking too long

An iteration taking around 2 minutes to do actions. This is average time. I want to terminate the iteration if it is taking more than 2 minutes. How can I check the time while running the flow, with Parallel Activity maybe? Or is there any approach?
Plus, how can I terminate the flow and move to next iteration, using Throw?

Hi,

How about the following sample using Sopwatch class?

Sample
Sample20240819-1.zip (5.4 KB)

Please note that this assumes main logic is not very busy. If it’s very (always) busy logic, it may be necessary to use InvokeWorkflowFile activity with Isolate option because Parallel activity is pseudo parallel.

Regards,

1 Like

Hi @Yasir_Yaqoob,

One of the ways could be to put the workflow in a Different XAML.
Then set a timeout on XAML level.

For handling the exception have a Time Exceeded Catch block to continue to next iteration.

Hope this helps.

Regards
Ankit

My main logic is very busy. So I used Parallel, placed the main logic in one branch, and then used a delay activity of 90 sec and Throw activity right after the delay in the second branch. Haven’t tested it yet. But I think it will work.

XAML level? Sorry, I never worked in such ways and I don’t know much about this. Would you mind if I request a simple explanation about the XAML workflow?

I meant by Timeout property when we invoke a XAML

Regards

Hi,

It may be better to use InvokeWorkflow File activity with Isolate option. Can you try the following sample?

Sample
Sample20240819-1a.zip (4.6 KB)

Regards,

This is very simple, then. I am invoking a file to flow. It will save a lot of time. Thanks.

1 Like

Thank you @Yoichi for your effort but I found what I was looking for.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.