Skip to content

Queued Actions do not serialize models properly. #3375

Answered by crynobone
rakishii13 asked this question in Q&A
Discussion options

You must be logged in to vote
  1. Action uses cursor() to speed up populating actions for large resources.
  2. You need to consider that Running Action will query models to QueuedAction, QueuedAction will then have to query model (and relation) again, and then QueuedJob will also need to re-query model (and relations). This is highly inefficient.

You should be able to do the following:

namespace App;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Collection;

class QueuedJob implements ShouldQueue
{
    use Dispatchable;
    use InteractsWithQueue;
    u…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by crynobone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #3372 on May 04, 2021 09:08.