Questions tagged «queue»

5
我需要cron任务来处理队列吗?
我有一项任务大约需要45分钟才能完成,并且每天都需要完成(将用户同步到多个外部数据库等)。 为了处理工作,我设置了一个cron队列,hook_cron_queue_info()如下所示: function mymodule_cron_queue_info() { $queues = array(); $queues['update_users_queue'] = array( 'worker callback' => '_mymodule_process_user_queue_item', 'time' => 120, ); return $queues; } 我使用此功能填充队列: function mymodule_queue_all_users_for_synching() { //...query for users... $queue = DrupalQueue::get('update_users_queue'); foreach($users as $user) { $queue->createItem($user); } } 队列填充功能被称为cron任务。我使用Elysia Cron,因此我的实现hook_cronapi()是: function mymodule_cronapi($op, $job = NULL) { $items = array(); …
32 7  hooks  cron  queue 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.