예제 #1
0
 /**
  * Schedule all of the delayed jobs for a given timestamp.
  *
  * Searches for all items for a given timestamp, pulls them off the list of
  * delayed jobs and pushes them across to Resque.
  *
  * @param DateTime|int $timestamp Search for any items up to this timestamp to schedule.
  */
 public function enqueueDelayedItemsForTimestamp($timestamp)
 {
     $item = null;
     while ($item = ResqueScheduler::nextItemForTimestamp($timestamp)) {
         $this->log('queueing ' . $item['class'] . ' in ' . $item['queue'] . ' [delayed]');
         Resque_Event::trigger('beforeDelayedEnqueue', array('queue' => $item['queue'], 'class' => $item['class'], 'args' => $item['args']));
         $payload = array_merge(array($item['queue'], $item['class']), $item['args']);
         call_user_func_array('\\resque\\lib\\Resque::enqueue', $payload);
     }
 }
예제 #2
0
 /**
  * Create a new scheduled job and save it to the specified queue.
  *
  * @param timestamp $at UNIX timestamp when job should be executed.
  * @param string $queue The name of the queue to place the job in.
  * @param string $class The name of the class that contains the code to execute the job.
  * @param array $args Any optional arguments that should be passed when the job is executed.
  *
  * @return string
  */
 public function enqueueJobAt($at, $queue, $class, $args = array())
 {
     return ResqueScheduler::enqueueAt($at, $queue, $class, $args);
 }