1

Laravel Artisan Schedulers configured in app/console/kernel.php are not Creating Mutex files, thus WithoutOverlapping never working. However I never get errors. Those files are supposed to be at storage/frameworks/ right?

Due to overlaps of Artisan Commands, my data geting duplicated.

Sample commands written in kernel.php :

$schedule->command('clear:logFiles')->everyMinute()->withoutOverlapping();
$schedule->command('validate:sslCommerzTransactions')->withoutOverlapping()->everyTenMinutes();
$schedule->command('send:queuedTelegramNotifications')->withoutOverlapping()->everyMinute();
$schedule->command('send:queuedRewardNotifications')->withoutOverlapping()->everyMinute();

I also made a custom function to test, but I see no mutex file:

$schedule->call(function () {
            sleep(900);
        })->name("test")->withoutOverlapping(2);

Is there anything I can do to confirm is my mutex lock files really generating/working or not?

I have configured cache table and set cache_driver to database, now I see no entries there. Though my Artisan commands are running now. Strange?

My Use case: I want to prevent overlapping. I mean if a command execution is running, Laravel should it run it until the previous execution is finished, whater timely is configured.

Please help. any info needed? I will provide.

My Laravel version is 5.8 and Cache Driver: file, db both tested

Jaber Al Nahian
  • 903
  • 10
  • 15
  • 1
    The mutex is usually implemented on the cache so the entries should popup on whatever cache driver you are using. You might be able to confirm this if you use a db cache and compare the before and after contents of the cache table. Also `withoutOverlapping` means that this particular scheduled command should not overlap with itself if one instance runs until it's scheduled to run again. Your wording seems to imply you're expecting the different commands to not overlap each other – apokryfos Apr 01 '21 at 17:54
  • @apokryfos which folder/file I should check of new entries? Als I'll try db cache – Jaber Al Nahian Apr 01 '21 at 17:57
  • If you're using the file cache it's in storage/framework/cache but the structure there is cryptic it's not easy to find new entries. Database cache is for me the easiest because it's a matter of counting rows before and after – apokryfos Apr 01 '21 at 17:59
  • @apokryfos but according to https://stackoverflow.com/a/64151118/823454 , the files cache for this context are at storage/framework/ . Anyway my /storage/framework/cache is empty too on live server – Jaber Al Nahian Apr 01 '21 at 18:02
  • @apokryfos I have configured cache table and set cache_driver to database, now I see no entries there. Though my Artisan commands are running now. Strange? – Jaber Al Nahian Apr 01 '21 at 18:33
  • Very strange. Maybe there's things about how this works in 5.8 that I'm missing. – apokryfos Apr 01 '21 at 18:37
  • Thanks for pointing that cache driver is important here. I change it to "file" and mutex created normally. – Erlang Parasu May 29 '23 at 06:41

0 Answers0