I have module, called parser2, which does parsing from html pages. Everything works perfectly, except cron schedule. It just doesnt add my task to cron tasks, and in logs, i see there are 0 scheduled tasks, everytime cron runs. The next issue, if i manually start cron few times, after i’m getting white screen of death, and the only 1 thing that helps me, its delete parser2 tables from DB, and from system.table, and then run update.php.
Here is the code that should be doing all this work, but i cant understand where is error here
function parser_cron_queue_info() {
$info = array();
$info['get_parser_weather'] = array(
'worker callback' => 'parser_weather',
'time' => 10,
);
$query = db_select('parser_jobs', 'pn')
->fields('pn', array('id','time_run_in_crone'))
->condition('run_in_crone', 1)
->execute();
foreach ($query as $job){
$info['get_parser_weather_'.$job->id] = array(
'worker callback' => 'parser_weather',
'time' => $job->time_run_in_crone,
};
}
return $info;
}
function parser_cron() {
$query = db_select('parser_jobs', 'pn')
->fields('pn', array('id','time_run_in_crone'))
->condition('run_in_crone', 1)
->execute();
foreach ($query as $job){
$queue = DrupalQueue::get('get_parser_weather_'.$job->id);
$queue->createItem($job->id);
}
}
function parser_weather($job_id){
$job = parser_job_load($job_id);
_parser_url_delete_all();
_parser_url_add($job->start_url);
while (_parser_url_get_not_parsed())
{
parser_parse2($job);
};
}
Try getting the cron command the code is generating and then run it in you command line to make sure it is correct also double check if the user your script is running has permission to add new task.