mjphaynes / php-resque

php-resque is a Redis-backed PHP library for creating background jobs, placing them on multiple queues, and processing them later.
MIT License
222 stars 50 forks source link

Retry & ReQueue #73

Closed merlindorin closed 4 years ago

merlindorin commented 6 years ago

Unfortunately, I think I already know the answer but it costs nothing to ask...

Does php-resque support :

xelan commented 6 years ago

Hi @iam-merlin! Re-enqueuing will be implemented in the Resque Web UI. Automatic retry would probably also require significant adaptations in the php-resque library. There is no plan for this feature yet as far as I know.

merlindorin commented 6 years ago

Thx for your quick answer as usual :D. The Web UI will be a sugar for us but I need something less user friendly and more machine friendly (something like bin/resque job:requeue 12 and bin/resque jobs:list:error).

Do you have any tips to implement such commands (knowing that I'm not a redis-god)? I didn't see in code such method.

For the retry, after going deeper into the code last night, I don't feel it will be hard to implement. What I see is :

And ofc, all the retry logic.

Do you think my approach is silly?

xelan commented 6 years ago

Thank you for your quick feedback and great suggestion, @iam-merlin! Your proposed approach sounds good. It's just important to keep BC compatibility in mind, so jobs which do not have a retry value should still work without retry.

What do you mean with a default value backoff? That the job is retried several times with an increased time between retries? And probably the default value should be 0 (no retries) for compatibility with current applications. Otherwise, the new feature might lead to duplicate jobs instead of (expected) job failures.

merlindorin commented 6 years ago

"backoff" is for the retry strategy like :

For BC, I think we can keep it with default values.