Example #1
0
 /**
  * Schedule a task
  *
  * @param string $name
  * @param array $options options contain:
  *   start_at OR delay — required - start_at is time of first run. Delay is number of seconds to wait before starting.
  *   run_every         — optional - Time in seconds between runs. If omitted, task will only run once.
  *   end_at            — optional - Time tasks will stop being enqueued. (Should be a Time or DateTime object.)
  *   run_times         — optional - Number of times to run task. For example, if run_times: is 5, the task will run 5 times.
  *   priority          — optional - Priority queue to run the job in (0, 1, 2). p0 is default. Run at higher priorities to reduce time jobs may spend in the queue once they come off schedule. Same as priority when queuing up a task.
  * @param array $payload
  * @return mixed
  * @throws CException
  */
 public function workerPostSchedule($name, $options, $payload = array())
 {
     try {
         return $this->_worker->postSchedule($name, $options, $payload);
     } catch (Exception $e) {
         Yii::log('Error in IronWorker: ' . $e->getMessage(), 'error', 'ext.yiiron');
         throw new CException($e->getMessage());
     }
 }