Commit Graph

11 Commits

Author SHA1 Message Date
Matt Harrison ebb8ced803
Make next webhook not return a date when the webhook is already running.
A potential fix for #26851

This does change the get_next functionality slightly but if the hook is
already running then the next state should trigger a new one anyway.
2020-11-04 09:10:28 -05:00
Claudio Sanches d48f1d4e2e Fixed package tag usage 2020-08-05 13:36:24 -03:00
Brent Shepherd b924e36f11 Fix WC_Action_Queue::get_next() return value 2019-01-04 14:27:01 +00:00
Brent Shepherd 6eddeaec50 PHPCS fixes 2018-09-24 11:43:46 +10:00
Brent Shepherd 0c27837b2b Add cancel_all() to WC_Queue_Interface
And the WC_Action_Queue implementation of WC_Queue_Interface.

This avoids ambiguity between the behaviour of cancel(), which can
be confusing given it technically unschedules all actions for cron
or recurring actions, but only the next instance of a single action.
2018-09-20 15:42:24 +10:00
Brent Shepherd 32d3de3aa8 Use new as_ prefixed Action Scheduler functions 2018-09-20 15:39:56 +10:00
Gerhard Potgieter 19401ea7d0 Fix PHPCS errors on WC_Action_Queue and make sure to pass on correct variable in schedule_cront function. 2018-08-01 20:11:08 +02:00
Gerhard Potgieter 883a5f90eb Fix PHPCS errors in WC_Queue class 2018-08-01 20:07:14 +02:00
Brent Shepherd ab78e65af9 Update WC_Queue_Interface::get_next()
To more closely align return value with other date APIs in WC, namely
WC_Data. Includes changing return value to:

1. a WC_DateTime instead of a timestamp when a scheduled occurrence is found
2. null instead of false, similar to the default of WC_Data::set_date_prop()
2018-07-31 12:29:15 +10:00
Brent Shepherd d9158a8c0e Add WC_Queue and WC()->queue() wrapper for accessing it
To take care of instantiating a canonical job queue for use across
all of WooCommerce, and by 3rd party code.

Also use this new API for enqueuing webhooks instead of raw Action
Scheduler APIs.
2018-07-31 12:21:07 +10:00
Brent Shepherd 0611ff7665 Add WC_Action_Queue
As a wrapper for Action Scheduler. This implements the WC_Queue_Interface
so it can be used as WC core's job queue. Implementing WC_Queue_Interface
also means this class has more generic and appropriate job queue nomenclature
than Action Scheduler itself. For exsample, it provides a method for
non-delayed jobs, i.e. WC_Queue_Interface::add(), unlike Action Scheduler,
which requires scheduling a job for now(), which while fairly simple, is not
intuitive or immediately obvious to new comers.

This makes it both more clear and convenient to use Action Scheduler
as a simple job queue instead of just a queue for delayed jobs.
2018-07-31 12:21:04 +10:00