Failure retry looping workflow/activities
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2014 06:08 AM
Hi,
We have a SOAP activity that occasionally fails with a Socket Error (lord knows why - it has been raised as a HI).
To try and mitigate this (and could be useful for other workflows) if it fails I would to trigger a timer and retry again after 30 seconds. However I'd like it to only retry X number of times...
below is the workflow and the script in the "Something we want to run" script. The first one just creates the variable "workflow.scratchpad.i" which is what I'm using as the counter.
gs.log("Number of retries is: " + workflow.scratchpad.i);
answer = getAnswer();
function getAnswer() {
if(workflow.scratchpad.i < 2){
workflow.scratchpad.i++;
return "no";
}
else if (workflow.scratchpad.i > 1){
return "Yes";
}
}
However the workflow just cancels when it gets to the timer and doesn't wait as I'd expect:
Workflow context shows:
Any idea what I'm doing wrong???
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2014 02:12 PM
Both transition conditions on the "Something we want to run" activity are passing. In that situation, the engine queues up both the Timer and End. The Timer activity runs, but then gets immediately cancelled because End executes next. Check that Yes condition expression.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2014 05:30 AM
Hi,
I changed it for an IF statement and it seems to work a bit better as it will route if through the no condition but when it changes to "Yes" it syill seems to route through to the timer but is then cancelled ("Cancelling workflow - it has exceeded the max activity count of 100")
Script:
Then you can see it continues to log the answer as "Yes" but still loops roudn the No loop??
Workflow itself:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2014 07:29 AM
Using the Turnstile activity is alternative approach that requires less scripting. In this flow, the doSomething Run Script looks like this:
activity.scratchpad.doSomething = doSomething();
function doSomething() {
//return true if something worked, false if it failed
return false; //we're always returning false to test the failure exit
}
with conditions for:
activity.scratchpad.doSomething == true
activity.scratchpad.doSomething != true
Still, something is not quite sitting right with me about your script approach not working. I'll try to reproduce it next.