Repetitive execution of Laravel scheduled tasks

the timing of Laravel scheduled task execution is uncertain. I added withoutOverlapping () according to the document, but it doesn"t seem to take effect

.
Development environment: windows 10, laradock, Laravel 5.4.36

related codes

Code of kernel

$schedule- > command ("produce:email")-> withoutOverlapping ();

Code of the command
public function handle()
    {

        $name = mt_rand(10000,99999);

        Log::info($name . ":".date("Y-m-d H:i:s"));


        $this->parseAppName();

        $this->createQueue();

        arsort($this->queue);

        if(count($this->queue) <= 0){
            return ;
        }

        foreach ($this->queue as $key => $queue) {

            $this->getHistoryId($key,$queue["filter"]);

            $this->executeAdd($key,$queue);
        }


        Log::info($name .":".date("Y-m-d H:i:s"));
    }
the output log file is as follows: 80781 before the end of the task, the system opened 8 new tasks
[2018-07-10 03:23:18] local.INFO: 80781:2018-07-10 03:23:18  
[2018-07-10 03:24:07] local.INFO: 91189:2018-07-10 03:24:07  
[2018-07-10 03:25:05] local.INFO: 73828:2018-07-10 03:25:05  
[2018-07-10 03:26:09] local.INFO: 96934:2018-07-10 03:26:09  
[2018-07-10 03:27:06] local.INFO: 79930:2018-07-10 03:27:06  
[2018-07-10 03:28:13] local.INFO: 39674:2018-07-10 03:28:13  
[2018-07-10 03:29:06] local.INFO: 44935:2018-07-10 03:29:06  
[2018-07-10 03:30:16] local.INFO: 40087:2018-07-10 03:30:16  
[2018-07-10 03:31:05] local.INFO: 42935:2018-07-10 03:31:05  
[2018-07-10 03:31:26] local.INFO: 91189:2018-07-10 03:31:26 
 
[2018-07-10 03:31:26] local.INFO: 80781:2018-07-10 03:31:26
Mar.28,2021

clipboard.png

clipboard.png

I tested it is normal, your output may be the output of the old program
you can try to stop cron, after a period of time and then start to eliminate interference.


because it is withoutOverlapping, consider the following aspects:
1, the permission of storage and whether you have permission touch for schedule mutex files;
2. Execute php artisan schedule:run, multiple times to check whether the schedule mutex file is generated after the task executes sleep for more than a second.


problem solved:
refer to @ aaronwu's answer

1, permission of storage and whether there is permission for touch to be used in schedule mutex files;
2. Execute php artisan schedule:run, multiple times to check whether schedule mutex files are generated after the task executes sleep for more than a second.

first of all, check that there is no problem with permissions and write permissions.
then checks whether the schedule mutex file generates . OK, no, it has write permission and then does not generate the file, presumably it is a problem in the future where the mutex file is written.

File: \ vendor\ laravel\ framework\ src\ Illuminate\ Console\ Scheduling\ Event.php
this file can see the directory and name where the mutex file is located.
mine is: framework/schedule-755d6620f1985cc92ffef6bd535af9a0f3354c3d
public function mutexName()
    {
        return 'framework'.DIRECTORY_SEPARATOR.'schedule-'.sha1($this->expression.$this->command);
    }
then look at the source code to see that the mutex is the caching service of the system being used. Guess there is something wrong with the cache service.
then look at the cache configuration file and find that the previously configured cache driver CACHE_DRIVER=array has been changed to file.
File: \ vendor\ laravel\ framework\ src\ Illuminate\ Console\ Scheduling\ CacheMutex.php
/**
 
     * Create a new overlapping strategy.
     *
     * @param  \Illuminate\Contracts\Cache\Repository  $cache
     * @return void
     */
    public function __construct(Cache $cache)
    {
        $this->cache = $cache;
    }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3aa54-345de.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3aa54-345de.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?