Skip to content

Commit 231ea65

Browse files
committed
VIP-Go: change cron interval min value interval
VIP's cron setup https://wpvip.com/blog/wordpress-cron/ https://docs.wpvip.com/wordpress-on-vip/cron-control/ Can handle frequent heavy cron schedules. Increase job frequency does not equate to slower site performance as the jobs are run async on dedicated batch containers, not front end requests.
1 parent 7ed6c5d commit 231ea65

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

WordPress-VIP-Go/ruleset-test.inc

+10
Original file line numberDiff line numberDiff line change
@@ -577,3 +577,13 @@ $_SERVER["REMOTE_ADDR"]; // Error.
577577

578578
// WordPress.CodeAnalysis.AssignmentInTernaryCondition
579579
$var = ($a = 123) ? $a : 0; // Warning.
580+
581+
// WordPress.WP.CronInterval
582+
function my_add_weekly( $schedules ) {
583+
$schedules['every_30_seconds'] = array(
584+
'interval' => 30,
585+
'display' => __( 'Once every 30 seconds' )
586+
);
587+
return $schedules;
588+
}
589+
add_filter( 'cron_schedules', 'my_add_weekly'); // Warning.

WordPress-VIP-Go/ruleset-test.php

+1
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@
232232
550 => 1,
233233
556 => 1,
234234
579 => 1,
235+
589 => 1,
235236
],
236237
'messages' => [
237238
7 => [

WordPress-VIP-Go/ruleset.xml

+7
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@
232232
<rule ref="WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn">
233233
<severity>3</severity>
234234
</rule>
235+
<rule ref="WordPress.WP.CronInterval">
236+
<!-- cron runs async on VIP's batch containers, so high frequency schedules will not negatively impact performance. Cron runner polling interval is 60s, so make that the min -->
237+
<properties>
238+
<property name="min_interval" value="60"/>
239+
</properties>
240+
</rule>
235241

236242
<!-- Silence is golden, these don't affect us on VIP Go -->
237243
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable">
@@ -254,4 +260,5 @@
254260
<rule ref="WordPress.Security.EscapeOutput.ExceptionNotEscaped">
255261
<severity>0</severity>
256262
</rule>
263+
257264
</ruleset>

0 commit comments

Comments
 (0)