Comments (15)
same problem here, any solution? if we Queue::push its awaiting..
from laravel-async-queue.
im on windows btw.. solution:
public function startProcess($jobId, $delay = 0)
{
chdir($this->container['path.base']);
pclose(popen($this->getCommand($jobId, $delay), "r"));
//exec($this->getCommand($jobId, $delay));
}
from laravel-async-queue.
Tks @nmkr, now is running smoothly
from laravel-async-queue.
PHP cli is blocking, can only have 1 request. Not sure if that is the problem. But cli mode is only for testing right?
from laravel-async-queue.
And is this Linux? Or Windows? I'll try to reproduce and try the popen way.
from laravel-async-queue.
@barryvdh For me it's on linux. PHP cli is blocking but that should not be the issue, since the async queue spawns a new process, no ? And, yes the cli is mostly used in dev mode I assume as well.
from laravel-async-queue.
I have the same problem, but also when the app is running via apache mod_php...
By replacing exec with popen and pclose, it works (I'm on windows).
from laravel-async-queue.
Okay will check it out. Perhaps bring the Symfony process component back.
from laravel-async-queue.
In the user contributed notes of exec in php.net (http://php.net/manual/fr/function.exec.php), there is this comment, if it can help:
This will execute $cmd in the background (no cmd window) without PHP waiting for it to finish, on both Windows and Unix.
<?php
function execInBackground($cmd) {
if (substr(php_uname(), 0, 7) == "Windows"){
pclose(popen("start /B ". $cmd, "r"));
}
else {
exec($cmd . " > /dev/null &");
}
}
?>
So it seems that popen and pclose must be used on windows for execution in background.
from laravel-async-queue.
Can you all try this, using the Symfony Process command?
public function startProcess($jobId, $delay = 0)
{
$command = $this->getCommand($jobId, $delay);
$cwd = $this->container['path.base'];
$process = new \Symfony\Component\Process\Process($command, $cwd);
$process->run();
}
from laravel-async-queue.
@barryvdh Works fine for me :)
from laravel-async-queue.
Okay cool, if the rest can confirm (can also try 0.3.x@dev
) I'll push a new tag.
from laravel-async-queue.
For me it's still synchronous (PHP 5.6.5 CLI, linux).
I've tried with $process->start();
instead of $process->run();
(as per http://symfony.com/doc/current/components/process.html#running-processes-asynchronously) but still no success.
from laravel-async-queue.
What's odd is that it seems to be sync only for PHP commands. If I replace the command with $process = new \Symfony\Component\Process\Process("sleep(10)", $cwd);
it's async as expected.
from laravel-async-queue.
Strange. How I did it before is also how Laravel does it: https://github.com/laravel/framework/blob/388aa6a1c3aa16a4e7f6fa850fa6f08bd3143ccd/src/Illuminate/Console/Scheduling/Event.php#L126
from laravel-async-queue.
Related Issues (20)
- Issues with Process class and fromShellCommandline method in Laravel 8
- Notify when Queue ends
- Doesn't work with Laravel 5.6? HOT 2
- Laravel Horizon support? HOT 1
- Please support laravel 5.6.* HOT 2
- symfony/process 4+ error HOT 1
- Documentation HOT 1
- Laravel 5.7 support?
- Jobs freeze
- Prevent to exec a job before finish other
- cron jobed async queue is not working
- Errro Unknown error while connecting
- Laravel 5.8 issue
- Start Process is not compatible with symfony/process 5x
- How can I retry failed jobs?
- Laravel 7 / Synpony 5
- Alternative to the later method
- Suggestion to resolve queue conflict
- Dead lock HOT 1
- Doesn't make a lot of sense HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-async-queue.