Describe the bug
With WooCommerce prior to 3.5.0, a webhook with the same $args would not be scheduled to run within 10 minutes of another. This is a result of how the wp_schedule_single_event() WP Cron API works, as explained in the codex entry:
Note that scheduling an event to occur before 10 minutes after an existing event of the same name will be ignored, unless you pass unique values for $args to each scheduled event. See wp_next_scheduled() for more information.
However, when WooCommerce moved to use Action Scheduler, no such restriction was enforced. Action Scheduler & WC()->queue() will add anything requested to the queue.
This leads to potentially _a lot_ of duplicate scheduled actions for webhooks, which causes two problems:
I've seen at least one plugin leading to this issue, but I suspect there will be many more. Any plugin using order.updated webhooks is likely going to be creating the issue.
Expected behavior
To maintain backward compatibility and improve performance, I think it will be better to only schedule one of each webhook every 10 minutes.
Pull request incoming.
Just adding a note here. This is a pretty significant issue for any store utilising webhooks, effectively breaking renewals for the site, and would definitely support a release as soon as possible.
Most helpful comment
Just adding a note here. This is a pretty significant issue for any store utilising webhooks, effectively breaking renewals for the site, and would definitely support a release as soon as possible.