Laravel Excel 队列允许的内存大小

Laravel Excel Queue Allowed memory size

我正在尝试导出包含大约 100,000 行的 xlsx 文件,每个文件 12 个月 sheet 使用 Maatwebsite Excel This process takes around 15~30 mint, So I use a queue in laravel sheet 需要一个月 laravel 8 excel 以便将作业 运行 保留在后台并在完成时通知用户。在 php artisan queue:work --memory=10240 过程中它停止并在终端

中显示此错误

如果我 运行 php artisan queue:work 进程将停止并且作业仍在 jobs table 当我 运行 它再次失败并在 failed_jobs table 中显示此错误

Illuminate\Queue\MaxAttemptsExceededException: Maatwebsite\Excel\Jobs\AppendQueryToSheet has been attempted too many times or run too long. The job may have previously timed out.

我尝试服用但不适合我的东西

1- 在 php.ini 中更改 memory_limit post_max_size upload_max_filesize 我使用 WAMP SERVER

2- 在 config/excel.php.

中更改 memory_limit => 6000000chunk_size => 1100

此外,我注意到所有导出的文件都停在大小 555KB

导出代码使用队列

class MarkupAccountsYears

<?php

  namespace App\Exports;

  use App\Models\markupPreCalculate;
  use Maatwebsite\Excel\Concerns\FromQuery;
  use Maatwebsite\Excel\Concerns\WithTitle;

  class MarkupAccountsYears implements FromQuery, WithTitle
  {
    

    
    private $month;
    private $year;

    public function __construct(int $year, int $month)
    {
        $this->month = $month;
        $this->year  = $year;
    }


    public function query()
    {   >orderBy('TimeMsc');
       $finalItem = ['real'];
       return markupPreCalculate::query()->select('TimeMsc', '****', 'Login', 'Full_Name', 
        'Group', '****', '****', '****', '****', '****', '****')
         ->whereYear('TimeMsc', $this->year)
         ->whereMonth('TimeMsc', $this->month)
         ->orderBy('TimeMsc')
         ->where(function ($query) use ($finalItem) {
                foreach($finalItem as $keyword){
                  

                          if(is_numeric($keyword))
                          {
                            $query->orwhere('Login', '=',  $keyword);
                          }else
                          {
                            $query->orwhere('Group', 'like',  '%' . $keyword . '%');
                          }
                }
               
            });
    }

      /**
     * @return string
     */
    public function title(): string
    {
        return 'Month ' . $this->month;
    }
}

class MarkupAccount

<?php

namespace App\Exports;

use Illuminate\Contracts\Queue\ShouldQueue;
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
use Maatwebsite\Excel\Concerns\Exportable;

class MarkupAccount implements WithMultipleSheets, ShouldQueue
{
    
    use Exportable;
 
    protected $year;
    
    public function __construct(int $year)
    {
        $this->year = $year;
    }

    /**
     * @return array
     */
    public function sheets(): array
    {
      
        $sheets = [];

       for ($month = 1; $month <= 1; $month++) {
            $sheets[] = new MarkupAccountsYears($this->year, $month);
        }
        
        return $sheets;
    }
}

Class MarkupAccount

<?php

namespace App\Exports;

use Illuminate\Contracts\Queue\ShouldQueue;
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
use Maatwebsite\Excel\Concerns\Exportable;


class MarkupAccount implements WithMultipleSheets, ShouldQueue
{
    
    use Exportable;
 
    protected $year;
    
    public function __construct(int $year)
    {
        $this->year = $year;
    }

    /**
     * @return array
     */
    public function sheets(): array
    {
      
        $sheets = [];

       for ($month = 1; $month <= 1; $month++) {
            $sheets[] = new MarkupAccountsYears($this->year, $month);
        }
        
        return $sheets;
    }
}

控制器

public function downloadExcl(){  
  (new MarkupAccount(2021))->queue('test'.time().'.xlsx')->chain([dump("Done")]);
}

有什么办法可以解决这个问题还是我做错了什么?

我通过在 php folder 中增加 php.ini 中的 memory_limit 来解决问题,我正在编辑 apache folder[=16= 中的 php.ini ]

%wamp%\bin\php\phpx.x.x\php.ini not under %wamp%\bin\apache\apachex.x.x\php.ini