question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Workflow.retry that takes a function to decide if retry is needed

See original GitHub issue

Is your feature request related to a problem? Please describe. Workflow.retry RetryOptions.doNotRetry is a list of strings. So any exception is converted to a string before matching. In many scenarios, the retry is based on a specific information in a specific exception down the chain or even on some other information within the workflow body.

Describe the solution you’d like An API that takes a function (or lambda) that can execute random user provided logic to decide if retry is needed.

Additional context This only works for retries from the workflow code. The service side retries have to rely on string matching in the current architecture. An activity already can decide itself that the error is not retryable by throwing an non-retryable ApplicationFailure.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Spikhalskiycommented, Feb 18, 2022

@niegus We typically don’t provide ETAs for feature requests. Contributions are welcomed, this is a great starter issue.

0reactions
nieguscommented, Mar 4, 2022

@Spikhalskiy This feature request comes from this thread: https://community.temporal.io/t/temporal-queue-activities/3095/8 to retry in certain cases, doNotRetryPredicate() could do the trick, but it would require to write negative code 😅

Eg.

doNotRetryPredicate(ex -> !(ex.getCause() instanceof TimeoutFailure && 
               ((TimeoutFailure) ex.getCause()).getTimeoutType() == TimeoutType.TIMEOUT_TYPE_SCHEDULE_TO_START))

IMHO (as a customer of this lib) it would be easier:

retryOnPredicate(ex -> ex.getCause() instanceof TimeoutFailure && 
               ((TimeoutFailure) ex.getCause()).getTimeoutType() == TimeoutType.TIMEOUT_TYPE_SCHEDULE_TO_START)

WDYT? Would that make sense?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Retry steps | Workflows - Google Cloud
This example uses a standard retry predicate, determining when to perform a retry, and a custom maximum number of retries and backoff parameters....
Read more >
Retry all workflow logic in `Workflow.retry` - Community Support
If you need to retry the whole workflow then the recommended way is to specify retry options on workflow start using WorkflowOptions. This...
Read more >
Retry Failed Activities - AWS Flow Framework for Java
Retry -Until-Success Strategy · Implement a nested TryCatch or TryCatchFinally class in your workflow's entry point method. · Execute the activity in doTry...
Read more >
How to Set Up Retries for Your Argo Workflows - Pipekit
If the step takes more than 75 seconds, both the step and the workflow will be marked as Failed. The limit is needed...
Read more >
Three Ways to Retry Failures In Your Serverless Application
When the client runs into an issue, it will retry the command up to 5 times before throwing the exception in your function...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found