Пример #1
0
 /**
  * Queue the job after the specified number of seconds
  *
  * @param $seconds
  * @return Builder
  */
 public function in($seconds)
 {
     if ((int) $seconds != $seconds || !$seconds > 0) {
         throw new \InvalidArgumentException('Please ensure the seconds field is a positive integer');
     }
     return $this->at((int) Time::time() + $seconds);
 }
Пример #2
0
 /**
  * @return $this
  */
 public function saveTimeSeriesData()
 {
     if (!$this->saveTimeseriesData) {
         return $this;
     }
     $time = Time::time();
     $time -= $time % self::LOG_INTERVAL_SECONDS;
     if ($time >= $this->lastLog + self::LOG_INTERVAL_SECONDS) {
         $this->lastLog = $time;
         $this->commandExecutor->execute(new SaveTimeSeriesData($time));
         // clear the data appx once every 50 times this function is called
         //rand(0, 50) or
         $this->commandExecutor->execute(new ClearTimeSeriesData($this->saveTimeseriesData));
     }
     return $this;
 }