PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.4.2
JetFormBuilder — Dynamic Blocks Form Builder v3.6.4.2
3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / vendor / woocommerce / action-scheduler / classes / ActionScheduler_AsyncRequest_QueueRunner.php
jetformbuilder / vendor / woocommerce / action-scheduler / classes Last commit date
WP_CLI 1 month ago abstracts 1 month ago actions 1 year ago data-stores 1 month ago migration 1 year ago schedules 1 year ago schema 1 month ago ActionScheduler_ActionClaim.php 1 year ago ActionScheduler_ActionFactory.php 1 year ago ActionScheduler_AdminView.php 1 year ago ActionScheduler_AsyncRequest_QueueRunner.php 1 year ago ActionScheduler_Compatibility.php 1 year ago ActionScheduler_DataController.php 1 month ago ActionScheduler_DateTime.php 1 year ago ActionScheduler_Exception.php 2 years ago ActionScheduler_FatalErrorMonitor.php 1 year ago ActionScheduler_InvalidActionException.php 1 year ago ActionScheduler_ListTable.php 1 year ago ActionScheduler_LogEntry.php 1 year ago ActionScheduler_NullLogEntry.php 1 year ago ActionScheduler_OptionLock.php 1 year ago ActionScheduler_QueueCleaner.php 1 year ago ActionScheduler_QueueRunner.php 1 year ago ActionScheduler_RecurringActionScheduler.php 1 month ago ActionScheduler_SystemInformation.php 1 year ago ActionScheduler_Versions.php 1 year ago ActionScheduler_WPCommentCleaner.php 1 year ago ActionScheduler_wcSystemStatus.php 1 month ago
ActionScheduler_AsyncRequest_QueueRunner.php
94 lines
1 <?php
2
3 defined( 'ABSPATH' ) || exit;
4
5 /**
6 * ActionScheduler_AsyncRequest_QueueRunner class.
7 */
8 class ActionScheduler_AsyncRequest_QueueRunner extends WP_Async_Request {
9
10 /**
11 * Data store for querying actions
12 *
13 * @var ActionScheduler_Store
14 */
15 protected $store;
16
17 /**
18 * Prefix for ajax hooks
19 *
20 * @var string
21 */
22 protected $prefix = 'as';
23
24 /**
25 * Action for ajax hooks
26 *
27 * @var string
28 */
29 protected $action = 'async_request_queue_runner';
30
31 /**
32 * Initiate new async request.
33 *
34 * @param ActionScheduler_Store $store Store object.
35 */
36 public function __construct( ActionScheduler_Store $store ) {
37 parent::__construct();
38 $this->store = $store;
39 }
40
41 /**
42 * Handle async requests
43 *
44 * Run a queue, and maybe dispatch another async request to run another queue
45 * if there are still pending actions after completing a queue in this request.
46 */
47 protected function handle() {
48 do_action( 'action_scheduler_run_queue', 'Async Request' ); // run a queue in the same way as WP Cron, but declare the Async Request context.
49
50 $sleep_seconds = $this->get_sleep_seconds();
51
52 if ( $sleep_seconds ) {
53 sleep( $sleep_seconds );
54 }
55
56 $this->maybe_dispatch();
57 }
58
59 /**
60 * If the async request runner is needed and allowed to run, dispatch a request.
61 */
62 public function maybe_dispatch() {
63 if ( ! $this->allow() ) {
64 return;
65 }
66
67 $this->dispatch();
68 ActionScheduler_QueueRunner::instance()->unhook_dispatch_async_request();
69 }
70
71 /**
72 * Only allow async requests when needed.
73 *
74 * Also allow 3rd party code to disable running actions via async requests.
75 */
76 protected function allow() {
77
78 if ( ! has_action( 'action_scheduler_run_queue' ) || ActionScheduler::runner()->has_maximum_concurrent_batches() || ! $this->store->has_pending_actions_due() ) {
79 $allow = false;
80 } else {
81 $allow = true;
82 }
83
84 return apply_filters( 'action_scheduler_allow_async_request_runner', $allow );
85 }
86
87 /**
88 * Chaining async requests can crash MySQL. A brief sleep call in PHP prevents that.
89 */
90 protected function get_sleep_seconds() {
91 return apply_filters( 'action_scheduler_async_request_sleep_seconds', 5, $this );
92 }
93 }
94