Esempio n. 1
0
 /**
  * @Route("/jobs/{type}/", name="status.jobs.type", methods="GET")
  * @param Request $request
  * @param string $type
  * @return Job[]
  */
 public function getJobs(Request $request, string $type) : array
 {
     $since = 0;
     if ($request->query->getInt('futureOnly')) {
         $since = $this->now();
     }
     return $this->gateway->getEventsByType($type, $since);
 }
Esempio n. 2
0
 /**
  * @Route("/stats/", name="status.index")
  */
 public function index() : array
 {
     $stats = $this->stats->getAll();
     try {
         $redisStats = $this->getRedis()->info();
     } catch (PredisException $e) {
         $redisStats = [];
     }
     return ['jobs' => $this->messageQueue->getEventsByType(), 'stats' => $stats, 'redis' => $redisStats];
 }
Esempio n. 3
0
 /**
  * @return array
  */
 protected function getCrons() : array
 {
     $crons = $this->includeFile(Cron::CACHE_FILE);
     if (empty($crons)) {
         return [];
     }
     foreach ($this->gateway->getEventsByType(CronEvent::CRON) as $id => $job) {
         /** @var CronEvent $event */
         $event = $job->getEvent();
         /** @var TimingEvent $timingEvent */
         $timingEvent = $event->getEvent();
         $name = $timingEvent->getTimingId();
         if (isset($crons[$name])) {
             unset($crons[$name]);
         }
     }
     return $crons;
 }