vendredi 27 novembre 2020

how to keep alive parent job in laravel?

I am using laravel jobs i have chained all the jobs like this

 CalculateSingleInvoice::withChain([
            (new CalculateInvoiceGrandTotal($invoice,$this->user_id,true))->onQueue('invoice'),
        ])->dispatch($invoice,$this->user_id = 1,true)->onQueue('invoice');

These jobs are working fine

Now there is another job inside CalculateSingleInvoice

which is

 CalculateSingleConsignment::dispatch($consignment, $total_consignments, $i)->onQueue('invoice');

Now the problem is i want to keep alive parent CalculateSingleInvoice job and it works when i use dispatchNow() but the problem is there are almost 1000 child jobs so parent jobs gets timeout . I know i can set time out but i dont want to use timeout because it can vary from job to job.

What could be best approach?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire