Cron schedule not updating after run
Cron-jobs are incredibly slow in my website.
I created this small script, outside of the Wordpress environment, just to test the response time of WP Cron:
?php
//Method which does a basic curl get request
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
//getinfo gets the data for the request
$info = curl_getinfo($ch);
//output the data to get more information.
print_r($info);
curl_close($ch);
return $data;
}
get_data('http://www.example.com?wp-cron.php?doing_wp_cron=1486419273');
These are the results:
Array
(
[url] = http://www.example.com/?wp-cron.php?doing_wp_cron=1486419273
[content_type] =
[http_code] = 0
[header_size] = 0
[request_size] = 0
[filetime] = -1
[ssl_verify_result] = 0
[redirect_count] = 0
[total_time] = 42.822546 // Important
[namelookup_time] = 0
[connect_time] = 0
[pretransfer_time] = 0
[size_upload] = 0
[size_download] = 0
[speed_download] = 0
[speed_upload] = 0
[download_content_length] = -1
[upload_content_length] = -1
[starttransfer_time] = 0
[redirect_time] = 0
[certinfo] = Array
(
)
[primary_ip] =
[primary_port] = 0
[local_ip] =
[local_port] = 0
[redirect_url] =
)
As you can see it has an incredible load time of almost 43 seconds.
These are my Crons as reported by Crontol plugin:
The biggest problem I see here is that the Next run is not updating, meaning every cron runs every time... That's probably what's making it so slow, isn't it?
How to make the Next run actually changes according to the cron's Recurrence?