Stop a schedule when process fails

Please go through above WF example screenshot. In the same example if you enter a counter and put a exit condition once counter reaches after several attempts to make Setme1=Setme2 condition. that will exit the loop.

Hope my inputs are useful.