resque-retry icon indicating copy to clipboard operation
resque-retry copied to clipboard

Need to know the retry instance

Open richard0000 opened this issue 1 year ago • 1 comments

In order to only run certain logic when the job is retried a specific amount of times, I need to know the retry instance that's begin run.

So let's say I want to raise a specific exception when I know the job was already retried 3 times.

I couldn't find a way to do so with the current interface, reading the documentation. Is there any way? If not, is it reasonable to consider implementing it?

Thanks in advance.

richard0000 avatar Jun 07 '23 23:06 richard0000

It looks like you can access this through the retry_attempt accessor which is initialized in code, but backed in redis, you could also reconstruct the key if necessary and query redis as well -- I hope this helps.

jzaleski avatar Jun 08 '23 02:06 jzaleski