Let’s say I’m downloading a large file from the web, or I triggered some kind of local batch process that churns through a DB and emits an output file. Clearly I don’t know how long it’s going to take to fully arrive on my local disk before I can move along in my workflow.
If I use “Path Exists” right after I begin the download, it will fail. This forces me to either add a fixed “Delay” activity (always a bad idea)… or set up a loop where I retry “Path Exists”. Of course this forces me to also create and increment a counter to limit my retry attempts, etc.
Why doesn’t “Path Exists” simply have a timeout value (essentially a hidden retry under the covers)?
@FlpVsg
Just off the top of my head, you could simply use a Retry Scope with File Exists as the condition activity. You can set the time delay to like 00:00:01 then retry like 60 times for 1minute, and it will exit once the File Exists.
I pulled off a similar solution, using a count variable inside while and setting condition as “count < 20” meaning I’ll try 20 times to find the file in the directory. However, if it finds the file before it breaks the loop and continue the flow.
@FlpVsg Good idea. =)
Do While loop is something I used a while back but switched to Retry Scope cause I found it easier. Plus, the Retry scope will throw an error like if the file never shows up. In a Do While, you need additional logic so it doesn’t get stuck in an infinite loop and/or throws an error if file never shows up.
If i want to check path exists of one file that’s located on shared server,
because network speed’s slow, it will take time to access to the shared server
→ will timeout be reached in this case?
That depends on the value you specify for the timeout of the chosen activity you use. You are free to make a timeout as long or short as your requirements dictate.
Hi @snoopy
You should be able to use any activity that returns a Boolean output in the Condition part of the Retry. Alternatively, you can use that Boolean activity in the Action part, then use the Is True with the boolean variable in the Condition part (however, placing the Boolean activity in the Condition part is preferred).
Additionally, you can simply use the Is True activity (which is what I normally use anyway), and use a condition expression. For example, Directory.Exists(folder) or File.Exists(filepath) would work in the Is True.
EDIT: note: you can leave the action part blank if you just use a Boolean activity in the condition part.