constants.php 1.21 KB
Newer Older
1
2
<?php

3
namespace Automattic\WP\Cron_Control;
4

5
/**
6
7
 * Adjustable queue size and concurrency limits, to facilitate scaling
 */
Erick Hitter's avatar
Erick Hitter committed
8
9
10
$job_queue_size = 10;
if ( defined( 'CRON_CONTROL_JOB_QUEUE_SIZE' ) && is_numeric( \CRON_CONTROL_JOB_QUEUE_SIZE ) ) {
	$job_queue_size = absint( \CRON_CONTROL_JOB_QUEUE_SIZE );
11
	$job_queue_size = max( 1, min( $job_queue_size, 250 ) );
Erick Hitter's avatar
Erick Hitter committed
12
}
13
14
15
define( __NAMESPACE__ . '\JOB_QUEUE_SIZE', $job_queue_size );
unset( $job_queue_size );

Erick Hitter's avatar
Erick Hitter committed
16
17
18
$job_concurrency_limit = 10;
if ( defined( 'CRON_CONTROL_JOB_CONCURRENCY_LIMIT' ) && is_numeric( \CRON_CONTROL_JOB_CONCURRENCY_LIMIT ) ) {
	$job_concurrency_limit = absint( \CRON_CONTROL_JOB_CONCURRENCY_LIMIT );
19
	$job_concurrency_limit = max( 1, min( $job_concurrency_limit, 250 ) );
Erick Hitter's avatar
Erick Hitter committed
20
}
21
22
23
24
25
define( __NAMESPACE__ . '\JOB_CONCURRENCY_LIMIT', $job_concurrency_limit );
unset( $job_concurrency_limit );

/**
 * Job runtime constraints
26
 */
Erick Hitter's avatar
Erick Hitter committed
27
28
29
const JOB_QUEUE_WINDOW_IN_SECONDS = 60;
const JOB_TIMEOUT_IN_MINUTES      = 10;
const JOB_LOCK_EXPIRY_IN_MINUTES  = 30;
30
31
32
33

/**
 * Locks
 */
Erick Hitter's avatar
Typo  
Erick Hitter committed
34
const LOCK_DEFAULT_LIMIT              = 10;
Erick Hitter's avatar
Erick Hitter committed
35
const LOCK_DEFAULT_TIMEOUT_IN_MINUTES = 10;
36
37
38
39
40
41
42

/**
 * Consistent time format across plugin
 *
 * Excludes timestamp as UTC is used throughout
 */
const TIME_FORMAT = 'Y-m-d H:i:s';