Skip to content

Commit 6d95c3b

Browse files
committed
Isolate canonical cron scheduling
1 parent 2ec7efe commit 6d95c3b

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

packages/runtime-cloudflare/src/worker.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ async function runBootProbe(phase: string, bucket: R2Bucket): Promise<Response>
556556
}
557557
}
558558

559-
if (["mdi-includes", "mdi-embed", "mdi-textdomain", "mdi-ai-client", "mdi-plugin-constants", "mdi-muplugins", "mdi-plugins", "mdi-globals", "mdi-theme", "mdi-site-health-class", "mdi-site-health", "mdi-current-user", "mdi-init", "mdi-wp-loaded", "mdi-init-callbacks", "mdi-init-exclude-scheduling", "mdi-init-exclude-block-registration", "mdi-init-exclude-theme-patterns-styles", "mdi-init-exclude-widgets", "mdi-init-exclude-rest-connectors-sitemaps", "mdi-init-exclude-initial-content-types", "mdi-widgets-callbacks", "mdi-widgets-constructors", "mdi-widgets-hooks", "mdi-widgets-factory", "mdi-widgets-remaining-hooks", "mdi-widgets-direct-basic-classic-first", "mdi-widgets-direct-basic-classic-first-pages", "mdi-widgets-direct-basic-classic-first-calendar", "mdi-widgets-direct-basic-classic-first-archives", "mdi-widgets-direct-basic-classic-first-meta", "mdi-widgets-direct-basic-classic-first-search", "mdi-widgets-direct-basic-classic-first-text", "mdi-widgets-direct-basic-classic-second", "mdi-widgets-direct-media", "mdi-widgets-direct-custom-html-block", "mdi-widgets-direct-block", "mdi-widgets-direct-custom-html", "mdi-widgets-direct-factory-all", "mdi-widgets-option-reads", "mdi-widgets-get-settings", "mdi-widgets-get-settings-first", "mdi-widgets-get-settings-second", "mdi-widgets-register-one"].includes(phase)) {
559+
if (["mdi-includes", "mdi-embed", "mdi-textdomain", "mdi-ai-client", "mdi-plugin-constants", "mdi-muplugins", "mdi-plugins", "mdi-globals", "mdi-theme", "mdi-site-health-class", "mdi-site-health", "mdi-current-user", "mdi-init", "mdi-wp-loaded", "mdi-init-callbacks", "mdi-init-exclude-scheduling", "mdi-init-exclude-wp-cron", "mdi-init-exclude-privacy-schedule", "mdi-init-exclude-update-schedule", "mdi-init-exclude-wp-cron-privacy-schedule", "mdi-init-exclude-wp-cron-update-schedule", "mdi-init-exclude-privacy-update-schedule", "mdi-init-exclude-block-registration", "mdi-init-exclude-theme-patterns-styles", "mdi-init-exclude-widgets", "mdi-init-exclude-rest-connectors-sitemaps", "mdi-init-exclude-initial-content-types", "mdi-widgets-callbacks", "mdi-widgets-constructors", "mdi-widgets-hooks", "mdi-widgets-factory", "mdi-widgets-remaining-hooks", "mdi-widgets-direct-basic-classic-first", "mdi-widgets-direct-basic-classic-first-pages", "mdi-widgets-direct-basic-classic-first-calendar", "mdi-widgets-direct-basic-classic-first-archives", "mdi-widgets-direct-basic-classic-first-meta", "mdi-widgets-direct-basic-classic-first-search", "mdi-widgets-direct-basic-classic-first-text", "mdi-widgets-direct-basic-classic-second", "mdi-widgets-direct-media", "mdi-widgets-direct-custom-html-block", "mdi-widgets-direct-block", "mdi-widgets-direct-custom-html", "mdi-widgets-direct-factory-all", "mdi-widgets-option-reads", "mdi-widgets-get-settings", "mdi-widgets-get-settings-first", "mdi-widgets-get-settings-second", "mdi-widgets-register-one"].includes(phase)) {
560560
const runtime = await bootWordPressRuntime("do-not-attempt-installing", true, true, undefined, await packagedCanonicalMarkdownSeed(), new Uint8Array(markdownPrimaryBootstrapIndex), SITE_URL, {}, bucket)
561561
try {
562562
const evidence = (await runtime.php.run({ code: wordpressProbeCode(phase) })).text.trim()
@@ -851,6 +851,12 @@ require '/wordpress/wp-load.php';`
851851
"wp_schedule_site_health_cron",
852852
"WP_Site_Health::maybe_create_scheduled_event",
853853
],
854+
"mdi-init-exclude-wp-cron": ["wp_cron"],
855+
"mdi-init-exclude-privacy-schedule": ["wp_schedule_delete_old_privacy_export_files"],
856+
"mdi-init-exclude-update-schedule": ["wp_schedule_update_checks"],
857+
"mdi-init-exclude-wp-cron-privacy-schedule": ["wp_cron", "wp_schedule_delete_old_privacy_export_files"],
858+
"mdi-init-exclude-wp-cron-update-schedule": ["wp_cron", "wp_schedule_update_checks"],
859+
"mdi-init-exclude-privacy-update-schedule": ["wp_schedule_delete_old_privacy_export_files", "wp_schedule_update_checks"],
854860
"mdi-init-exclude-block-registration": [
855861
"register_block_core_*",
856862
"register_core_block_*",

tests/cloudflare-runtime.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ test("Cloudflare MDI init diagnostics use fixed callback inventories and exclusi
161161
for (const phase of [
162162
"mdi-init-callbacks",
163163
"mdi-init-exclude-scheduling",
164+
"mdi-init-exclude-wp-cron",
165+
"mdi-init-exclude-privacy-schedule",
166+
"mdi-init-exclude-update-schedule",
167+
"mdi-init-exclude-wp-cron-privacy-schedule",
168+
"mdi-init-exclude-wp-cron-update-schedule",
169+
"mdi-init-exclude-privacy-update-schedule",
164170
"mdi-init-exclude-block-registration",
165171
"mdi-init-exclude-theme-patterns-styles",
166172
"mdi-init-exclude-widgets",
@@ -189,6 +195,12 @@ test("Cloudflare MDI init diagnostics use fixed callback inventories and exclusi
189195
assert.match(worker, /sort\(\$identifiers, SORT_STRING\)/)
190196
assert.match(worker, /ksort\(\$inventory, SORT_NUMERIC\)/)
191197
assert.match(worker, /"wp_schedule_update_checks"/)
198+
assert.match(worker, /"mdi-init-exclude-wp-cron": \["wp_cron"\]/)
199+
assert.match(worker, /"mdi-init-exclude-privacy-schedule": \["wp_schedule_delete_old_privacy_export_files"\]/)
200+
assert.match(worker, /"mdi-init-exclude-update-schedule": \["wp_schedule_update_checks"\]/)
201+
assert.match(worker, /"mdi-init-exclude-wp-cron-privacy-schedule": \["wp_cron", "wp_schedule_delete_old_privacy_export_files"\]/)
202+
assert.match(worker, /"mdi-init-exclude-wp-cron-update-schedule": \["wp_cron", "wp_schedule_update_checks"\]/)
203+
assert.match(worker, /"mdi-init-exclude-privacy-update-schedule": \["wp_schedule_delete_old_privacy_export_files", "wp_schedule_update_checks"\]/)
192204
assert.match(worker, /"WP_Site_Health::maybe_create_scheduled_event"/)
193205
assert.match(worker, /"register_block_core_\*"/)
194206
assert.match(worker, /"WP_Block_Supports::init"/)
@@ -229,6 +241,7 @@ test("Cloudflare MDI init diagnostics use fixed callback inventories and exclusi
229241
assert.match(worker, /"create_initial_taxonomies"/)
230242
assert.match(worker, /"wp_create_initial_post_meta"/)
231243
assert.match(worker, /do_action\('init'\);/)
244+
assert.match(worker, /'completed' => true, 'removedCallbacks' => \$removed, 'memoryBeforeBytes' => \$memory_before, 'memoryBytes' => memory_get_usage\(true\), 'peakMemoryBytes' => memory_get_peak_usage\(true\)/)
232245
assert.doesNotMatch(worker, /searchParams\.get\([^)]*callback|searchParams\.get\([^)]*exclude|searchParams\.get\([^)]*widget/)
233246
})
234247

0 commit comments

Comments
 (0)