victor rivera
victor rivera

Reputation: 11

Create a command, a job recursive in laravel or something like that

I want to create a function in laravel that is executed once and only when finished it is executed again. It doesn't help me that it runs every second because if for some reason it is delayed, results would be duplicated. I wanted to try creating a recursive command but it doesn't allow me to create infinite loops, can you suggest me something? (sorry if my english is not perfect).

Upvotes: 0

Views: 285

Answers (1)

kjoedion
kjoedion

Reputation: 580

You can use the withoutOverlapping method:

$schedule->command('emails:send')->withoutOverlapping();

Learn more here: https://laravel.com/docs/9.x/scheduling#preventing-task-overlaps

Upvotes: 1

Related Questions