You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I create a command, it command should work from 3am until 23pm.
is_plum_time function returns bool to check time.
It get contracts from database and split them to 3 or 4 part, it create workers array.
Then it gives them to Concurrency::run.
Steps To Reproduce
`
public function handle(): void
{
while (true) {
if (! is_plum_time()) {
sleep(60);
continue;
}
$this->manager();
}
}
public function manager(): void
{
$this->info('Manager started work at '.now()->format('Y-m-d H:i:s'));
$count = 1;
$workers = [];
$chunks = ContractCard::query()
->select([
'contract_cards.branch_id',
'contract_cards.plum_card_id',
'contracts.id AS contract_id',
'contracts.client_id',
'contracts.current_debt',
])
->join('contracts', 'contracts.id', '=', 'contract_cards.contract_id')
->where('contracts.current_debt', '>', Setting::contractMinDebtAmount())
->where('contracts.status', ContractStatus::ACTIVE)
->where('contract_cards.active', true)
->get()
->split($count)
->toArray();
foreach ($chunks as $chunk) {
$workers[] = fn () => WorkerJob::run($chunk);
}
$this->info('Workers created: '.count($workers));
Concurrency::run($workers);
}
`
The text was updated successfully, but these errors were encountered:
[previous exception] [object] (Symfony\Component\Process\Exception\ProcessTimedOutException(code: 0): The process "'/usr/bin/php8.4' 'artisan' invoke-serialized-closure" exceeded the timeout of 60 seconds. at /vendor/symfony/process/Process.php:1181)
The default Concurrency driver is the ProcessDriver, which will convert each task to be run as a Illuminate\Process\PendingProcess, and this has a default timeout of 60 seconds.
* The maximum number of seconds the process may run.
*
* @var int|null
*/
public$timeout = 60;
You can either use the ForkDriver (needs the spatie/fork package to be installed, check the docs for how to use it), or write, and register, a custom driver which increases or removes that timeout.
The relevant code would be your WorkerJob, and from the snippet you posted there will always be only one chunk, as $count = 1 on the beginning is never changed.
But I assume you might have omitted some parts you deemed as irrelevant.
Laravel Version
12.3.0
PHP Version
8.4
Database Driver & Version
No response
Description
I create a command, it command should work from 3am until 23pm.
is_plum_time function returns bool to check time.
It get contracts from database and split them to 3 or 4 part, it create workers array.
Then it gives them to Concurrency::run.
Steps To Reproduce
`
`
The text was updated successfully, but these errors were encountered: