Saturday, January 8, 2022

[SOLVED] Call api every 20s - error "Maximum Execution Time'

Issue

I want to call an api every ~20s in an Laravel app.

I created a loop with a final sleep of 20s in job that I launch with the command dispatchAfterResponse but I still get the error "Maximum Execution Time" after a while.

We can't use cron job since the minimum period is 1mn. Any idea?


Solution

Finally I found the solution, there is a nice package from spatie available on github.

https://github.com/spatie/laravel-cronless-schedule

https://laravel-news.com/sub-minute-and-cron-less-scheduled-tasks-in-laravel



Answered By - Dri372