Skip to main content
added 51 characters in body; edited title
Source Link
arrubiu
  • 3.3k
  • 2
  • 35
  • 64

Queue doesn't enter on worker function with Elysia cron

I'm trying to use queue api with cron, everything seems work but drupal does not enter on the "worker" function. I don't understand whyThe problem there is only if I enable Elysia Cron (and I've to enable it..)

<?php 

/**
 * Implements hook_cron_queue_info().
 */
function monitor_import_cron_queue_info() {
  $queue['monitor_import_queue'] = array(
    'worker callback' => 'monitor_import_queue_worker',
    'time' => 10,
  );
  return $queue;
}

/**
 * Implements hook_cron().
 */
function monitor_import_cron() {

  $call = new MyWS();
  $params = new getSoggettoView();
  $params->limit = '10'; //$limit;
  $params->offset = '0';
  $results = $call->getSoggettoView($params);
  $items = $results->return;
  $queue = DrupalQueue::get('monitor_import_queue'); // grab queue
  $queue->createQueue(); // initialize
  foreach ($items as $item) {
    $queue->createItem($item);
  }
}

/**
 * Worker callback
 *
 * @see mymodule_cron_queue_info().
 */
function monitor_import_queue_worker($item) {
  $a = 1;
}

Queue doesn't enter on worker function

I'm trying to use queue api with cron, everything seems work but drupal does not enter on the "worker" function. I don't understand why..

<?php 

/**
 * Implements hook_cron_queue_info().
 */
function monitor_import_cron_queue_info() {
  $queue['monitor_import_queue'] = array(
    'worker callback' => 'monitor_import_queue_worker',
    'time' => 10,
  );
  return $queue;
}

/**
 * Implements hook_cron().
 */
function monitor_import_cron() {

  $call = new MyWS();
  $params = new getSoggettoView();
  $params->limit = '10'; //$limit;
  $params->offset = '0';
  $results = $call->getSoggettoView($params);
  $items = $results->return;
  $queue = DrupalQueue::get('monitor_import_queue'); // grab queue
  $queue->createQueue(); // initialize
  foreach ($items as $item) {
    $queue->createItem($item);
  }
}

/**
 * Worker callback
 *
 * @see mymodule_cron_queue_info().
 */
function monitor_import_queue_worker($item) {
  $a = 1;
}

Queue doesn't enter on worker function with Elysia cron

I'm trying to use queue api with cron, everything seems work but drupal does not enter on the "worker" function. The problem there is only if I enable Elysia Cron (and I've to enable it..)

<?php 

/**
 * Implements hook_cron_queue_info().
 */
function monitor_import_cron_queue_info() {
  $queue['monitor_import_queue'] = array(
    'worker callback' => 'monitor_import_queue_worker',
    'time' => 10,
  );
  return $queue;
}

/**
 * Implements hook_cron().
 */
function monitor_import_cron() {

  $call = new MyWS();
  $params = new getSoggettoView();
  $params->limit = '10'; //$limit;
  $params->offset = '0';
  $results = $call->getSoggettoView($params);
  $items = $results->return;
  $queue = DrupalQueue::get('monitor_import_queue'); // grab queue
  $queue->createQueue(); // initialize
  foreach ($items as $item) {
    $queue->createItem($item);
  }
}

/**
 * Worker callback
 *
 * @see mymodule_cron_queue_info().
 */
function monitor_import_queue_worker($item) {
  $a = 1;
}
Tweeted twitter.com/#!/StackDrupal/status/453126445620269057
Source Link
arrubiu
  • 3.3k
  • 2
  • 35
  • 64

Queue doesn't enter on worker function

I'm trying to use queue api with cron, everything seems work but drupal does not enter on the "worker" function. I don't understand why..

<?php 

/**
 * Implements hook_cron_queue_info().
 */
function monitor_import_cron_queue_info() {
  $queue['monitor_import_queue'] = array(
    'worker callback' => 'monitor_import_queue_worker',
    'time' => 10,
  );
  return $queue;
}

/**
 * Implements hook_cron().
 */
function monitor_import_cron() {

  $call = new MyWS();
  $params = new getSoggettoView();
  $params->limit = '10'; //$limit;
  $params->offset = '0';
  $results = $call->getSoggettoView($params);
  $items = $results->return;
  $queue = DrupalQueue::get('monitor_import_queue'); // grab queue
  $queue->createQueue(); // initialize
  foreach ($items as $item) {
    $queue->createItem($item);
  }
}

/**
 * Worker callback
 *
 * @see mymodule_cron_queue_info().
 */
function monitor_import_queue_worker($item) {
  $a = 1;
}