Lars-Janssen
2 years ago

Laravel job

Posted 2 years ago by Lars-Janssen

Hi,

I've got a job that sends lots of notifications:

public function handle()
{
    foreach ($this->subscriptions as $subscription) {
        if ($subscription->user->permission()->isActive()) {
            $subscription->user->notify(new ForumSubscriptionNotifciation($this->message));
        }
    }
}

The job is being queued with beanstalkd (laravel forge).

In the notification ForumSubscriptionNotifciation I make lost of queries. For example: $this->message->forum->slug, $this->message->user->last_name

I cannot eager load this because the queued job accepts an Eloquent model in its constructor, only the identifier for the model will be serialized onto the queue.

Does this matter for performance? Or is it no problem because this is queued?

Please sign in or create an account to participate in this conversation.