action-scheduler
action-scheduler copied to clipboard
Add retries to Actions
Adds an optional field to the ActionScheduler API for a retry parameter. (For non-recurring actions).
// For example, this tries `do_work` 1 time (if it fails the first time).
as_enqueue_async_action( 'do_work', [], '', 1 );
Exceptions thrown by an Action schedule a new Action (with the same hook and args) on an exponential backoff algorithm.
Tests included.
- [x] Update the API
- [x] Update store
- wpPostStore
- [x]
save_action() - [x]
fetch_action()
- [x]
- DBStore
- [x]
save_action() - [x]
fetch_action()
- [x]
- wpPostStore
- [x] Implement retries in QueueRunner
- [x] Update UI
- [x] Ensure backwards compatibility
- [x] Add tests
Closing/opening to re-trigger travis.
Update version / hooks
@n3f We have other PRs in progress that will require a version bump so we will be bumping the version in a separate PR.
The ability to retry certain actions is a must-have for any queue runner, nice work!
What's the current status on this PR? Anything I can do to help?
It works as is, but @rrennick has a valid point about the storage. I was hoping to not require schema changes, but that's probably what's needed at this point.
@ObliviousHarmony, I wanted to get your thoughts on this and how it could potentially be integrated with WooCommerce Webhooks.
- Would we need some mechanism for the webhook to interrogate the process to see if there would be a retry (before logging a failed delivery)?
- Is it OK to throw an Exception to trigger a retry?
Any news here? Would love to use this kind of functionality!
Noodling on this a little, I'm curious why we don't extend support for retries to recurring actions.
On one hand I understand they may not be useful in some cases (perhaps for actions that recur with high frequency) but, hypothetically, what if the service I have sold to my customers is a weekly email: I really want that email to go out, every week, because that's my business offering: and if it doesn't work I'd like it to automatically retry n times. Why wouldn't we allow for that?
Just curious if there are other technical reasons that make it unattractive.
Is this still planned ?
Webhooks automatically retrying themselves is a must have. Thanks for your effort in this. @n3f
A reviewer (@vedanshujain) commented, but I thnk that n3f didn't read it.
If someone know a bit about it, and acknowledge the comments, this may get resolved. Or is @rrennick the only one that can merge the pull request?
Anyways, thanks!
Would be useful to see this come to fruition. Even simply having the ability to manually re-run/retry an action would be useful. We have an action that gets scheduled as follow up to receiving a webhook. If the action fails we don't have a good way of setting the same action with the same parameters back up. Ideally, we'd see the failed action, look into the problem, fix it the issue, and run the action again.
Closing, as it doesn't seem like there is an active need for this (and, it would be possible to implement from the parent application via a self-cancelling recurring action, etc).