JussiMannisto
1 week ago
131
3
Laravel

Prevent overlapping of two different commands

Posted 1 week ago by JussiMannisto

I have a scheduled maintenance command A and a scheduled updater command B. I'd like to prevent these commands from running concurrently. Event::withoutOverlapping() only prevents a command overlapping with itself, so it won't help.

Does Laravel have an inbuilt mechanism for this, like sharing the mutex between two commands?

Ps. I know there are many ways of doing this, like file locks etc., but I'm interested if Laravel has something to offer.

Please sign in or create an account to participate in this conversation.