Esempio n. 1
0
 /**
  * Calculates the real next job runtime dependend on lastJob.
  *
  * @param Xinc\Core\Job\JobInterface $lastJob
  *
  * @return integer next job runtime as timestamp
  */
 public function getNextTime(\Xinc\Core\Job\JobInterface $lastJob = null)
 {
     $lastRunTime = 0;
     if ($lastJob != null) {
         $lastRunTime = $lastJob->getStartTime();
     }
     if ($lastJob != null) {
         $nextRunTime = $this->getInterval() + $lastRunTime;
         /**
          * Make sure that we dont rerun every build if the daemon was paused
          */
         if ($nextRunTime + $this->getInterval() < time()) {
             $nextRunTime = time();
         }
     } else {
         // never ran, schedule for now
         $nextRunTime = time();
     }
     //         $build->debug(
     //             'getNextTime:'
     //             . ' lastbuild: ' . date('Y-m-d H:i:s', $lastRunTime)
     //             . ' nextbuild: ' . date('Y-m-d H:i:s', $nextRunTime)
     //         );
     return $nextRunTime;
 }
Esempio n. 2
0
 /**
  * Calculates the real next job runtime dependend on lastJob.
  *
  * @param Xinc\Core\Job\JobInterface $lastJob
  *
  * @return integer next job runtime as timestamp
  */
 public function getNextTime(\Xinc\Core\Job\JobInterface $lastJob = null)
 {
     $lastRunTime = 0;
     if ($lastJob != null) {
         $lastRunTime = $lastJob->getStartTime();
     }
     $nextRunTime = $this->getTimeFromCron($lastRunTime);
     //         $build->debug(
     //             'getNextBuildTime:'
     //             . ' lastbuild: ' . date('Y-m-d H:i:s', $lastRunTime)
     //             . ' nextbuild: ' . date('Y-m-d H:i:s', $nextRunTime)
     //         );
     return $nextRunTime;
 }