Let MySQL do the time logic when looking for tasks

This commit is contained in:
Dane Everitt 2020-10-25 15:06:54 -07:00
parent 23872b844a
commit 8c6327fd32
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
5 changed files with 24 additions and 168 deletions

View file

@ -47,19 +47,4 @@ class ScheduleRepository extends EloquentRepository implements ScheduleRepositor
throw new RecordNotFoundException;
}
}
/**
* Return all of the schedules that should be processed.
*
* @param string $timestamp
* @return \Illuminate\Support\Collection
*/
public function getSchedulesToProcess(string $timestamp): Collection
{
return $this->getBuilder()->with('tasks')
->where('is_active', true)
->where('is_processing', false)
->where('next_run_at', '<=', $timestamp)
->get($this->getColumns());
}
}