If I have a workflow function that is like:
export async function workflow(params) {
try {
await activityA(params);
}
catch (err) {
await activityB(params);
}
}
And I set 5 retries on activityA, does that mean activity B/that catch block will only run once activityA has been retried and failed 5 times?
Hi Rifruf,
Thank you for using our Forum!
By default Temporal activities have an automatic retry. However, to answer your question, yes, Activity B will only run once Activity A has been retried and failed 5 times.
You will get a generic error whether it its a Javascript or Typescript error in regards to Activity A. Although Activity B will still execute.
1 Like
Let’s say activityB also takes in the error as a parameter. If activityA fails for different reasons those during those 5 retries, I assume activityB will only be run once, with the error message/reason from the 5th retry of activityA, correct?
Yes, Activity B will be executed after all retries of Activity A have been exhausted. The error from the last retry for Activity A will be passed on to Activity B.
1 Like
How many times activity B is run depends on the retry policy set in proxyActivities. Also, for it to receive the error, you need to pass it as an arg, like activityB(params, err)
1 Like
Note that this will not be serialized properly using the default data converter, you should probably extract the relevant error information into a JSON serializable object and pass that along.