mercredi 28 février 2018

excessive delay in queue - laravel

Goodnight I need to send more than 1000 emails for each event created, and for this I use queue (as Laravel's documentation says), but when sending the emails I have to wait until all the emails are sent to return to the view of control Panel

this is my "store" function in NewsEvents.php controller that sends the emails

 public function store(Request $request)
{
    $attributes = request()->validate(News::$rules, News::$messages);

    $news = $this->createEntry(News::class, $attributes);

    //queue for sending emails 
     $this->dispatch(new Nevent($news));


    return redirect_to_resource();
}

the "handle" function of job "Nevent.php"

 public function handle()
{
    //   
     $users=User::where('tipo_user','user')->get();                  
         foreach($users as $user)
         {
             $user->notify(new EventCreated($this->news));
             echo 'enviado correo';
             Informe::create([
                'event_id' => $this->news->id,
                'total' => '1',
                'tipo' => 'invitacion',
                'dst_id' => $user->id,
                'estado' => 'correcto',
            ]);

         }
}

What could be the problem?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2HVav2Q
via IFTTT

Aucun commentaire:

Enregistrer un commentaire