Giter VIP home page Giter VIP logo

Comments (15)

nmkr avatar nmkr commented on July 2, 2024

same problem here, any solution? if we Queue::push its awaiting..

from laravel-async-queue.

nmkr avatar nmkr commented on July 2, 2024

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.

grzmartins avatar grzmartins commented on July 2, 2024

Tks @nmkr, now is running smoothly

from laravel-async-queue.

barryvdh avatar barryvdh commented on July 2, 2024

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.

barryvdh avatar barryvdh commented on July 2, 2024

And is this Linux? Or Windows? I'll try to reproduce and try the popen way.

from laravel-async-queue.

jvelo avatar jvelo commented on July 2, 2024

@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.

bioteck avatar bioteck commented on July 2, 2024

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.

barryvdh avatar barryvdh commented on July 2, 2024

Okay will check it out. Perhaps bring the Symfony process component back.

from laravel-async-queue.

bioteck avatar bioteck commented on July 2, 2024

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.

barryvdh avatar barryvdh commented on July 2, 2024

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.

bioteck avatar bioteck commented on July 2, 2024

@barryvdh Works fine for me :)

from laravel-async-queue.

barryvdh avatar barryvdh commented on July 2, 2024

Okay cool, if the rest can confirm (can also try 0.3.x@dev) I'll push a new tag.

from laravel-async-queue.

jvelo avatar jvelo commented on July 2, 2024

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.

jvelo avatar jvelo commented on July 2, 2024

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.

barryvdh avatar barryvdh commented on July 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.