Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonYH committed Nov 10, 2019
1 parent fae5528 commit eb08a46
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/crontab/src/Crontab.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function tick(): void
{
Timer::tick($this->tickTime * 1000, function () {
// All task
$tasks = CrontabRegister::getCronTasks();
$tasks = CrontabRegister::getCronTasks(time());

// Push task to channel
foreach ($tasks as $task) {
Expand Down
3 changes: 1 addition & 2 deletions src/crontab/src/CrontabRegister.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ public static function registerCron(string $className, string $methodName, $objA
/**
* @return array
*/
public static function getCronTasks(): array
public static function getCronTasks($time): array
{
$tasks = [];
$time = time();
foreach (self::$crontabs as $crontab) {
['class' => $className, 'method' => $methodName, 'cron' => $cron] = $crontab;
if (!CrontabExpression::parseObj($cron, $time)) {
Expand Down

0 comments on commit eb08a46

Please sign in to comment.