its still only a single thread.
it would be quicker if you queued the email and then ran a separate queue worker which would then be working in parallel.
Hello everyone,
I'm having a bit of trouble seeing some performance improvements while sending out a news email to approximately 60 recipients.
This is not a app which the recipient list will grow, and may get to 200 emails max which is why I haven't implemented mail delivery such as mailchimp etc.
Previously, in the store command I was sending out emails one by one via the following:
$post->save();
$staff_id_array = StaffNotification::where('esd_news', '1')->get('staff_id');
$staff_ids = array();
foreach($staff_id_array as $id)
{
array_push($staff_ids, $id['staff_id']);
}
$staff = Staff::find($staff_ids);
Notification::send($staff, new NewAdminNewsPosted($post));
return redirect()->route('esd.admin.posts.show', $post->id)->with('success', 'Post Created');
And then transitioned the action of sending an email to:
$post->save();
$staff_id_array = array();
foreach(StaffNotification::where('esd_news', '1')->get('staff_id') as $s) {
array_push($staff_id_array, $s);
}
\Artisan::call('EmailAdminNewsPost', ['post' => $post, 'staff_id_array' => $staff_id_array]);
return redirect()->route('esd.admin.posts.show', $post->id)->with('success', 'Post Created');
I have was surprised after moving this from our Dev to production that this change did not yield and speed increase when running the store function. I was expecting that by calling the artisan command the store method would be processed much quicker while the command line sends the emails.
its still only a single thread.
it would be quicker if you queued the email and then ran a separate queue worker which would then be working in parallel.
Please or to participate in this conversation.