On fresh installs, OCI warm-up for not-homepages might be missing mobile requests if the task is triggered before options are set
Context https://wp-media.slack.com/archives/CUKB44GNN/p1719826680391649?thread_ts=1719582525.193069&cid=CUKB44GNN
When running the async tasks for not-homepages of OCI warm-up, there are cases where cache_mobile and do_caching_mobile_files options are not set. In this case, we don't send the mobile requests.
Expected behavior
On fresh installs, the OCI warm-up for non-homepages should always send requests for mobile & desktop, unless a filter is applied to control cache_mobile and do_caching_mobile_files.
Acceptance Criteria ⚠️ The issue is not happening consistently: several tries are required to make it happen, as it is a race condition between OCI Warm up and plugin initialization.
- On fresh install, without filters or manual changes on
cache_mobileanddo_caching_mobile_files, the plugin must send 2 requests to the SaaS for OCI Warm Up per eligible pages (mobile & dekstop). - On fresh install, if a filter or manual change controls
cache_mobileanddo_caching_mobile_files, then the filter/manual change must be applied and the warm up requests must behave accordingly. - On regular OCI warm-up (not a fresh install), without filters or manual changes on
cache_mobileanddo_caching_mobile_files, the plugin must send 2 requests to the SaaS for OCI Warm Up per eligible pages (mobile & dekstop). -
- On regular OCI warm-up (not a fresh install), if a filter or manual change controls
cache_mobileanddo_caching_mobile_files, then the filter/manual change must be applied and the warm up requests must behave accordingly.
- On regular OCI warm-up (not a fresh install), if a filter or manual change controls
Additional information Proposed solution is to replace:
return $this->options->get( 'cache_mobile', 0 ) && $this->options->get( 'do_caching_mobile_files', 0 );
by
return $this->options->get( 'cache_mobile', 1 ) && $this->options->get( 'do_caching_mobile_files', 1 );
in is_mobile() of the OCI warm-up controller.
It could be the occasion to remove:
$plugin_version = (string) get_rocket_option( 'version', '' );
if ( ! $plugin_version ) { // We are warming up a fresh installation. Options are not set yet.
return true;
}