lumen定时任务调度出现内存堆积?
1). 当前使用的 Laravel 版本?
Lumen (8.3.1)
2). 当前使用的 php/php-fpm 版本?
PHP 版本:7.4.7
2. 问题描述?
使用了文档中的任务调度中的runInBackground()方法后,出现内存堆积的问题?
以下是我的代码
Kernel.php
protected function schedule(Schedule $schedule)
{
$schedule->command('test')->everyMinute()->runInBackground()->withoutOverlapping(1);
}
Test.php
<?php
namespace App\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
class Test extends Command
{
protected $signature = 'test';
protected $description = '测试';
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
Log::info('执行了一次,时间为'.Carbon::now()->toDateTimeString());
}
}
Cron条目
* * * * * php /www/aaa/artisan schedule:run >> /dev/null 2>&1
执行结果没啥问题,但是我发现容器里面的进程变成好多
??这是重新拉的框架代码跟容器 容器也只有一个Cron 在执行。??
这是完整的代码的下载链接
链接: pan.baidu.com/s/1-ie2NqDOm6x35ITgK... 提取码: 3a37
推荐文章: