We need to add tests to this package - it's not working properly!
Try $schedule->command('inspire')->withoutOverlappingMultiServer()->everyMinute();
by adding a sleep in Inspire like so:
public function handle()
{
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
sleep(120);
Log::info('ran cron job inspire now');
}
You will find that the withoutOverlappingMultiServer doesn't work. In the laravel log, you would find Inspire running every minute (not every 2 minutes) despite the locks!
The reason?
public function run(Container $container)
{
parent::run($container);
$this->clearMultiserver();
}
What's happening is that the lock is clearing before the task completes!
The lock clears before the task completes because if there are no before/after callbacks, the task runs in the background by triggering runCommandInBackground(). Then clearMultiServer is called and the lock is cleared before the task exits.
A quick fix is modify the Event.php to:
public function run(Container $container)
{
$this->runCommandInForeground($container);
$this->clearMultiserver();
}
We need to add tests to this package - it's not working properly!
Try
$schedule->command('inspire')->withoutOverlappingMultiServer()->everyMinute();
by adding a sleep in Inspire like so:You will find that the withoutOverlappingMultiServer doesn't work. In the laravel log, you would find Inspire running every minute (not every 2 minutes) despite the locks!
The reason?
The lock clears before the task completes because if there are no before/after callbacks, the task runs in the background by triggering runCommandInBackground(). Then clearMultiServer is called and the lock is cleared before the task exits.
A quick fix is modify the Event.php to:
Hope this helps!