You are here

function drush_services_client_process_queue in Services Client 7

Same name and namespace in other branches
  1. 7.2 services_client.drush.inc \drush_services_client_process_queue()

Process queued sync jobs

File

./services_client.drush.inc, line 118
Services client drush integration

Code

function drush_services_client_process_queue() {

  // How long can command run
  $time = drush_get_option('time', 55);
  $end = time() + $time;

  // Run only one process at time
  if (lock_acquire('services_client_process_queue', (double) $time)) {
    $queue = DrupalQueue::get('services_client_sync');
    while (time() < $end && ($item = $queue
      ->claimItem())) {
      services_client_queue_sync($item->data);
      $queue
        ->deleteItem($item);
    }
    lock_release('services_client_process_queue');
  }
}