Hi team, question about retries. Is there a good w...
# ask-community
j
Hi team, question about retries. Is there a good way to retry a task conditionally? Specifically, I want to retry a task on certain failures (e.g. db deadlocks). My thought was to use a state handler to detect the right situation (easy) but then how would I actually invoke the retry? Maybe return a new
Retrying
State object? Couldn’t find any doc examples of this and wanted to know if I missed anything obvious before spelunking. Thanks! 🙏
k
Hey Jeff, This is a really interesting question, let me get some more information on best practices here.
👍 1
Though I love doc spelunking, I think your best bet is to use a RETRY signal in the state handler that initiates whenever this conditional logic is met. Returning a new state object could work, but I think this signal will be cleaner.
P 1
j
Love it. Thanks for the quick response!
cc: @asm
a
👍