Can I separate different import tasks? I have feeds module installed and it runs multiple import jobs per cron. So I would like to at least order them (give different weights to them).
2 Answers
My first thought was to suggest Elysia Cron, but it sounds like Feeds doesn't yet support individual per feed cron jobs.
Alternatively, depending on your needs, you might consider the Feed Import module, which can apparently be made to support per feed cron jobs via Elysia Cron.
-
Thanks I decided to not use feeds at all - it's too heavy and does not so much. So I wrote my own module that works just fine– volocugaMay 26, 2012 at 5:53
You can indeed use Elysia and define a cron job for each of the feed imports like this:
/*
* Feed import managed by Elysia
*/
function MYMODULE_cronapi($op, $job = NULL) {
$items['fetch_MYFEED_cron'] = array(
'description' => 'Fetch MYFEED',
'rule' => '*/10 * * * *', // Every 10 minutes
'callback' => 'MYMODULE_fetch_MYFEED_cron',
'arguments' => array(array('MYFEED')),
);
return $items;
}
function MYMODULE_fetch_MYFEED_cron($feednames){
if (function_exists('feeds_source')){
foreach($feednames as $feedname){
$source = feeds_source($feedname);
$source->import();
}
}
}