Skip to content

Commit

Permalink
refactor(expr): simplify filter(), also cache undue case
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore committed Aug 16, 2018
1 parent cd3cd33 commit aab941e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Expression.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,12 @@ public function filter(array $jobs, $time = null)
foreach ($jobs as $name => $expr) {
$expr = $this->normalizeExpr($expr);

if (isset($cache[$expr])) {
$dues[] = $name;

continue;
if (!isset($cache[$expr])) {
$cache[$expr] = $this->isCronDue($expr, $time);
}

if ($this->isCronDue($expr, $time)) {
if ($cache[$expr]) {
$dues[] = $name;

$cache[$expr] = true;
}
}

Expand Down

0 comments on commit aab941e

Please sign in to comment.