Back

Queue stopping mid-code


Hi, I have a treatment that generates 2 PDF files, and then send them by mail. When I run this directly into my controller, everything is ok, mail is sending perfectly. The problem is that the process is quite long so I have to put in a queue. And when i do, the 1 PDF file is generated, and then everything stops.. Any idea ?

There is my job :

<?php

namespace App\Jobs;

use App\Jobs\Job;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Contracts\Bus\SelfHandling;
use App\Models\ReportBoiler as Boiler;
use iio\libmergepdf\Merger;
use Mail;

class sendEmail extends Job implements SelfHandling, ShouldQueue
{
  use InteractsWithQueue, SerializesModels;

  protected $orderId;

  /**
  * Create a new job instance.
  *
  * @return void
  */
  public function __construct($order_id)
  {
    $this->orderId = $order_id;
  }

  /**
  * Execute the job.
  *
  * @return void
  */
  public function handle()
  {
    // Some code that works in the controller
  }
}

EDIT : Ok so i found something that might be interesting ! I am using the Snappy Wrapper to generate my PDF files, when I run it from the controller, the PDF::loadView() method works properly, but when I do it in my job, it fails, create a PDF without any CSS, and the save() method fails

MaximeDawn replied 6 months ago Solution

The problem comes from URL::asset() function. IN the controller it returns "http://localhost/lam/foo.css" and in the job only "http://localhost/foo.css". It is Laravel standard to only consider "localhost" and not a sub-folder.


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us