When trying to send array payload of 100K records to a Laravel job (Horizon and Redis), it's throwing memory issue:
Allowed memory size of 536870912 bytes exhausted (tried to allocate 77598720 bytes)
Memory is set to 512MB.
The code I've used is
CreateSmsBroadcast::dispatch($user, $smsBroadcast, iterator_to_array($contacts),
$requestData)->onQueue('create-sms-broadcast');
When passing payload contacts (iterator),
CreateSmsBroadcast::dispatch($user, $smsBroadcast, $contacts, $requestData)
->onQueue('create-sms-broadcast');
then getting following issue:
// vendor/laravel/framework/src/Illuminate/Queue/Queue.php
protected function createObjectPayload($job)
{
return [
'displayName' => $this->getDisplayName($job),
'job' => 'Illuminate\Queue\CallQueuedHandler@call',
'maxTries' => $job->tries ?? null,
'timeout' => $job->timeout ?? null,
'timeoutAt' => $this->getJobExpiration($job),
'data' => [
'commandName' => get_class($job),
'command' => serialize(clone $job), // line of error
],
];
}
Serialization of 'Generator' is not allowed
I do not want to increase the memory. So please suggest me on how shall I fix above issue?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2RAPJdc
via IFTTT
Aucun commentaire:
Enregistrer un commentaire