【发布时间】:2012-09-06 02:02:57
【问题描述】:
我正在阅读 wp-includes 中 cron.php 的代码,spawn_cron() 似乎是实际执行注册任务的代码。
函数的最后两行:
$cron_url = site_url( 'wp-cron.php?doing_wp_cron=' . $doing_wp_cron );
wp_remote_post( $cron_url, array( 'timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters( 'https_local_ssl_verify', true ) ) );
它只是打开 wp-cron.php,将任务作为查询参数传递。
cron.php 顶部的 API 说明:
* Schedules a hook which will be executed once by the WordPress actions core at
* a time which you specify. The action will fire off when someone visits your
* WordPress site, if the schedule time has passed.`
我的问题是,假设访问者打开站点的一个页面,然后注册的任务被 cron API 触发。如果任务很繁重并且需要几分钟才能完成,访问者是否会在任务完成之前获得一个尚未完全加载的页面?
[编辑] 为了澄清我在问什么,问题是 WP Cron API 会在页面加载完成后运行任务吗?
【问题讨论】: