PluginProbe ʕ •ᴥ•ʔ
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin / 2.1.1
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin v2.1.1
4.9.0 0.9.6 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.2 1.7.0 1.7.1 1.8.0 1.8.1 1.9.0 2.0.0 2.0.1 2.1.1 2.2.1 2.3.1 2.4.0 2.5.0 2.5.1 2.6.0 2.7.0 2.8.0 2.9.0 3.0.1 3.0.2 3.0.3 3.1.0 3.10.0 3.11.0 3.11.1 3.2.0 3.2.1 3.3.0 3.4.0 3.5.0 3.5.1 3.5.2 3.6.1 3.7.0 3.8.0 3.8.2 3.9.0 4.0.1 4.1.0 4.1.1 4.2.0 4.3.0 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.8.0 trunk 0.10.0 0.10.1 0.11.1 0.11.2 0.3.1 0.3.2 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.5.2 0.6 0.7 0.8 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 0.9.0 0.9.1 0.9.2 0.9.3 0.9.4 0.9.5
wp-mail-smtp / vendor / woocommerce / action-scheduler / classes / ActionScheduler_AsyncRequest_QueueRunner.php
wp-mail-smtp / vendor / woocommerce / action-scheduler / classes Last commit date
WP_CLI 6 years ago abstracts 6 years ago actions 6 years ago data-stores 6 years ago migration 6 years ago schedules 6 years ago schema 6 years ago ActionScheduler_ActionClaim.php 6 years ago ActionScheduler_ActionFactory.php 6 years ago ActionScheduler_AdminView.php 6 years ago ActionScheduler_AsyncRequest_QueueRunner.php 6 years ago ActionScheduler_Compatibility.php 6 years ago ActionScheduler_DataController.php 6 years ago ActionScheduler_DateTime.php 6 years ago ActionScheduler_Exception.php 6 years ago ActionScheduler_FatalErrorMonitor.php 6 years ago ActionScheduler_InvalidActionException.php 6 years ago ActionScheduler_ListTable.php 6 years ago ActionScheduler_LogEntry.php 6 years ago ActionScheduler_NullLogEntry.php 6 years ago ActionScheduler_OptionLock.php 6 years ago ActionScheduler_QueueCleaner.php 6 years ago ActionScheduler_QueueRunner.php 6 years ago ActionScheduler_Versions.php 6 years ago ActionScheduler_WPCommentCleaner.php 6 years ago ActionScheduler_wcSystemStatus.php 6 years ago
ActionScheduler_AsyncRequest_QueueRunner.php
98 lines
1 <?php
2 /**
3 * ActionScheduler_AsyncRequest_QueueRunner
4 */
5
6 defined( 'ABSPATH' ) || exit;
7
8 /**
9 * ActionScheduler_AsyncRequest_QueueRunner class.
10 */
11 class ActionScheduler_AsyncRequest_QueueRunner extends WP_Async_Request {
12
13 /**
14 * Data store for querying actions
15 *
16 * @var ActionScheduler_Store
17 * @access protected
18 */
19 protected $store;
20
21 /**
22 * Prefix for ajax hooks
23 *
24 * @var string
25 * @access protected
26 */
27 protected $prefix = 'as';
28
29 /**
30 * Action for ajax hooks
31 *
32 * @var string
33 * @access protected
34 */
35 protected $action = 'async_request_queue_runner';
36
37 /**
38 * Initiate new async request
39 */
40 public function __construct( ActionScheduler_Store $store ) {
41 parent::__construct();
42 $this->store = $store;
43 }
44
45 /**
46 * Handle async requests
47 *
48 * Run a queue, and maybe dispatch another async request to run another queue
49 * if there are still pending actions after completing a queue in this request.
50 */
51 protected function handle() {
52 do_action( 'action_scheduler_run_queue', 'Async Request' ); // run a queue in the same way as WP Cron, but declare the Async Request context
53
54 $sleep_seconds = $this->get_sleep_seconds();
55
56 if ( $sleep_seconds ) {
57 sleep( $sleep_seconds );
58 }
59
60 $this->maybe_dispatch();
61 }
62
63 /**
64 * If the async request runner is needed and allowed to run, dispatch a request.
65 */
66 public function maybe_dispatch() {
67 if ( ! $this->allow() ) {
68 return;
69 }
70
71 $this->dispatch();
72 ActionScheduler_QueueRunner::instance()->unhook_dispatch_async_request();
73 }
74
75 /**
76 * Only allow async requests when needed.
77 *
78 * Also allow 3rd party code to disable running actions via async requests.
79 */
80 protected function allow() {
81
82 if ( ! has_action( 'action_scheduler_run_queue' ) || ActionScheduler::runner()->has_maximum_concurrent_batches() || ! $this->store->has_pending_actions_due() ) {
83 $allow = false;
84 } else {
85 $allow = true;
86 }
87
88 return apply_filters( 'action_scheduler_allow_async_request_runner', $allow );
89 }
90
91 /**
92 * Chaining async requests can crash MySQL. A brief sleep call in PHP prevents that.
93 */
94 protected function get_sleep_seconds() {
95 return apply_filters( 'action_scheduler_async_request_sleep_seconds', 5, $this );
96 }
97 }
98