Queue.php
1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
declare(strict_types=1);
namespace WP_Rocket\Engine\Optimization\RUCSS\Controller;
use WP_Rocket\Engine\Common\Queue\AbstractASQueue;
/**
* Queue
*
* A job queue using WordPress actions.
*
* @version 3.11.0
*/
class Queue extends AbstractASQueue {
/**
* Queue group.
*
* @var string
*/
protected $group = 'rocket-rucss';
/**
* Pending jobs cron hook.
*
* @var string
*/
private $pending_job_cron = 'rocket_rucss_pending_jobs_cron';
/**
* Check if pending jobs cron is scheduled.
*
* @return bool
*/
public function is_pending_jobs_cron_scheduled() {
return $this->is_scheduled( $this->pending_job_cron );
}
/**
* Cancel pending jobs cron.
*
* @return void
*/
public function cancel_pending_jobs_cron() {
$this->cancel_all( $this->pending_job_cron );
}
/**
* Schedule pending jobs cron.
*
* @param int $interval Cron interval in seconds.
*
* @return string
*/
public function schedule_pending_jobs_cron( int $interval ) {
return $this->schedule_recurring( time(), $interval, $this->pending_job_cron );
}
/**
* Add Async job with DB row ID.
*
* @param int $usedcss_row_id DB row ID.
*
* @return string
*/
public function add_job_status_check_async( int $usedcss_row_id ) {
return $this->add_async(
'rocket_rucss_job_check_status',
[
$usedcss_row_id,
]
);
}
}