sync
This commit is contained in:
@@ -29,17 +29,15 @@ protected function schedule(Schedule $schedule)
|
||||
private function scheduleCategory(Schedule $schedule, $locale, $categoryName, $taskName)
|
||||
{
|
||||
$schedule->call(function () use ($locale, $categoryName) {
|
||||
|
||||
|
||||
$category = Category::where('country_locale_slug', $locale)->where('name', $categoryName)->first();
|
||||
|
||||
if (!is_null($category))
|
||||
{
|
||||
$task = $category->country_locale_slug . "-" . $category->slug;
|
||||
if (! is_null($category)) {
|
||||
$task = $category->country_locale_slug.'-'.$category->slug;
|
||||
|
||||
$nextRun = DailyTaskSchedule::where('task', $task)->first();
|
||||
|
||||
if (!is_null($nextRun))
|
||||
{
|
||||
if (! is_null($nextRun)) {
|
||||
$currentTime = now();
|
||||
|
||||
if ($currentTime->gte($nextRun->next_run_time)) {
|
||||
@@ -57,11 +55,9 @@ private function scheduleCategory(Schedule $schedule, $locale, $categoryName, $t
|
||||
$nextRun->next_run_time = now()->addMinutes(rand(1200, 1440));
|
||||
$nextRun->save();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$nextRun = new DailyTaskSchedule;
|
||||
$nextRun->task = $category->country_locale_slug . "-" . $category->slug;
|
||||
$nextRun->task = $category->country_locale_slug.'-'.$category->slug;
|
||||
$nextRun->next_run_time = now()->addMinutes(rand(0, 1440));
|
||||
$nextRun->save();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user