Skip to content

Commit

Permalink
Always perform a full scan when scheduling a job initially
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Jul 31, 2023
1 parent d02bd31 commit 8d4c04a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions library/X509/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public function isFinished(): bool

public function updateLastScan($target)
{
if (! $this->isRescan()) {
if (! $this->isRescan() || ! isset($target->id)) {
return;
}

Expand All @@ -266,7 +266,19 @@ public function getChecksum(): string

protected function getScanTargets(): Generator
{
if (! $this->isRescan() || $this->fullScan) {
$generate = $this->fullScan || ! $this->isRescan();
if (! $generate) {
$run = X509JobRun::on($this->db)
->columns([new Expression('1')])
->filter(Filter::equal('schedule.job_id', $this->getId()))
->filter(Filter::unequal('total_targets', 0))
->limit(1)
->execute();

$generate = ! $run->hasResult();
}

if ($generate) {
yield from $this->generateTargets();
}

Expand Down

0 comments on commit 8d4c04a

Please sign in to comment.