public function statistics($group = null, Moment $at = null, array $query = []) { $totalsScheduledJobs = $this->jobs->scheduledCount($group, $query); $queued = $this->jobs->queued($group, $at, $at ? $at->before(T\hour(24)) : null, $query); $postponed = $this->jobs->postponed($group, $at, $query); return array_merge(['jobs' => ['queued' => $queued, 'postponed' => $postponed, 'zombies' => $totalsScheduledJobs - ($queued + $postponed)]], $this->jobs->recentHistory($group, $at, $query)); }
public function testShouldRescheduleInFiveMinutesWhenWasCreatedLessThan24HoursAgo() { $expectedToBeScheduledAt = T\hour(1)->fromNow()->toSecondPrecision(); $wasCreatedAt = T\hours(3)->ago(); $job = $this->givenJobThat($wasCreatedAt); $job->expects($this->once())->method('scheduleAt')->with($this->equalTo($expectedToBeScheduledAt)); $this->scheduler->schedule($job); }
public function testCountsPostponedJobs() { $this->aJobToSchedule()->inBackground()->execute(); $this->aJobToSchedule()->scheduleIn(T\hour(24))->execute(); $this->assertEquals(1, $this->repository->postponed('generic')); }