[Fix] Internal cron scheduler blocking view responses

Internal cron is now triggered by an axios request from the frontend so it can truly run in a separate request. Fixes #167
This commit is contained in:
2025-12-07 12:55:33 +01:00
parent 25034ee2f3
commit 6b688f72e0
8 changed files with 108 additions and 119 deletions
+3 -15
View File
@@ -4,11 +4,6 @@
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Schedule;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Schema;
use Illuminate\Routing\Events\RouteMatched;
use App\Models\Setting;
use App\Listeners\ScheduleListener;
use App\Jobs\CheckInvoiceDueDatesJob;
class EventServiceProvider extends ServiceProvider
@@ -22,16 +17,9 @@ public function boot(): void
{
parent::boot();
if (Schema::hasTable('settings')) {
$method = Setting::where('key', 'app.schedule_method')->value('value') ?? 'internal';
if ($method === 'internal') {
Event::listen(RouteMatched::class, [ScheduleListener::class, 'handle']);
}
}
// TODO: read where to put these or ask in the forums
// it seems to work here, but where is the apropriate place?
// Kernel::schedule did not work
// // TODO: read where to put these or ask in the forums
// // it seems to work here, but where is the apropriate place?
// // Kernel::schedule did not work
Schedule::command('caldav:sync')
->everyMinute()
->withoutOverlapping();