Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio committed Oct 30, 2024
1 parent f99cc4e commit bae1b4d
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Models\ScheduledJob;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\QueryException;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;

Expand Down Expand Up @@ -65,16 +66,20 @@ protected function setSeoDefaults(): void
protected function resolveSchedule(): void
{
$this->app->resolving(Schedule::class, function (Schedule $schedule) {
ScheduledJob::query()
->with('election')
->where('is_enabled', true)
->each(
fn (ScheduledJob $job) => $schedule
->job(new $job->job($job))
->cron($job->cron->value)
->withoutOverlapping()
->onOneServer()
);
try {
ScheduledJob::query()
->with('election')
->where('is_enabled', true)
->each(
fn (ScheduledJob $job) => $schedule
->job(new $job->job($job))
->cron($job->cron->value)
->withoutOverlapping()
->onOneServer()
);
} catch (QueryException $th) {
// fix for composer install
}
});
}
}

0 comments on commit bae1b4d

Please sign in to comment.