implies its possible. https://laravel.com/docs/10.x/scheduling#running-tasks-on-one-server
How does Laravel scheduled task work on different servers?
We have 3 servers, and I would like to run a command on all servers every ten mimutes without overlapping. We use redis as central cache server.
For example, in Kernel.php file,
protected function schedule(Schedule $schedule)
{
schedule->command('foo:bar')->everyTenMinutes()->withoutOverlapping();
What I don't understand is in vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php file,
public function mutexName()
{
$mutexNameResolver = $this->mutexNameResolver;
if (! is_null($mutexNameResolver) && is_callable($mutexNameResolver)) {
return $mutexNameResolver($this);
}
return 'framework'.DIRECTORY_SEPARATOR.'schedule-'.sha1($this->expression.$this->command);
}
This mutexName clearly doesn't use any kind of identifier of the server the command is running on. When use withoutOverlapping(), I think Laravel would only allow the first command that started from one server, and block the other two servers' command from runnning.
In other words, my question is, is it possible to run a command on all servers without overlapping when use a central cache server?
Please or to participate in this conversation.