Concurrency: Allow custom timeout settings #52853
Replies: 5 comments 2 replies
-
EDIT: looking into the code, I see EDIT2: it also has |
Beta Was this translation helpful? Give feedback.
-
Unfortunately, we can't interact with this class directly when using the For example this code: [$userCount, $orderCount] = Concurrency::timeout(300)->run([
fn () => 10,
fn () => 20,
]); Throw this error:
|
Beta Was this translation helpful? Give feedback.
-
A bit late to the party, but here is what I did: app()->bind(Illuminate\Process\Factory::class, function () {
return new class extends Illuminate\Process\Factory
{
public function newPendingProcess()
{
return parent::newPendingProcess()->forever();
}
};
}); You can use this snippet at the very beginning of a controller or globally in |
Beta Was this translation helpful? Give feedback.
-
This approach doesn't seem to work in Laravel 12 with Concurrency. Are there any plans to extend it so we can run Concurrency::timeout(123)->run() or Concurrency::forever()->run()? |
Beta Was this translation helpful? Give feedback.
-
Yes please! Any plans on extending this? I'm currently working on trying to load a 2GB XML file into a database, and following on @christophrumpel video (he was working with csvs), but found out this could increase the speed from 1hour to around 5'. https://github.com/christophrumpel/laravel-import-million-rows/blob/main/app/Traits/ImportHelper.php But, after 60s, the process dies due to the timeout issue. Any plans on upgrading it? |
Beta Was this translation helpful? Give feedback.
-
Currently, it's not possible to run tasks in
Concurrency
that take longer than 60 seconds to complete. This limitation stems from this line in the Laravel framework:https://github.com/laravel/framework/blob/11.x/src/Illuminate/Process/PendingProcess.php#L44
It would be helpful to allow custom timeouts for tasks. For example:
This way, developers could set a timeout for long-running tasks as needed.
Beta Was this translation helpful? Give feedback.
All reactions