When sending an email with queue job in laravel, it creates two processes, why? Is there a way to fix and keep only one? Is there any function that does this? for each dispatch, a single process.
Controller
public function sendMail()
{
$email = "gustavo.gomes@teste.com.br";
SendMail::dispatch($email);
return view('site.email-enviado');
}
Job
public function handle()
{
Mail::to('teste@test.com')->queue(new MensagemTesteMail($this->email));
}
public function build()
{
return $this->subject('gustavocamalionti@gmail.com')
->from(env("MAIL_FROM_ADDRESS", null), 'Teste email')
->view('emails.cadastro-sucesso');
}
php artisan queue:work