Skip to content

Commit

Permalink
adds next execution time to list table
Browse files Browse the repository at this point in the history
  • Loading branch information
leobeal committed May 6, 2019
1 parent f22dc41 commit 442d7e3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Command/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
"ID",
"Class",
"Expression",
"Next Execution",
"Can overlap",
"Run only on one instance",
]);
Expand All @@ -44,6 +45,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$job->getUniqueId(),
get_class($job),
$job->getSchedule()->getExpression(),
$job->getSchedule()->getNextRunDate()->format('d-m-y H:i:s'),
$job->getSchedule()->checkCanOverlap() ? 'yes' : 'no',
$job->getSchedule()->checkShouldRunOnOnlyOneInstance() ? 'yes' : 'no',
]);
Expand Down
12 changes: 12 additions & 0 deletions src/Jobs/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,18 @@ public function isDue($currentTime = 'now', string $timeZone = 'Europe/Berlin'):
return $this->cron->isDue($currentTime, $timeZone);
}

/**
* Sets whether the job should run on just one instance
* @param bool $decision
* @return $this
* @return \DateTime
*/
public function shouldRunOnOnlyOneInstance(bool $decision = true): self
{
$this->shouldRunOnOnlyOneServer = $decision;
return $this;
}

/**
* Return the next run date
* @param $currentTime
Expand Down

0 comments on commit 442d7e3

Please sign in to comment.