I have just started using pheanstalk and am having an issue with the reserve function. I have the following code for a worker script:
<?php
//... code that requires the autoload.php page among and other
$queue = new Pheanstalk_Pheanstalk("127.0.0.1:11300");
$queue->watch("action_tube");
$job = $queue->reserve();
//... code that would then output the information obtained from the job
?>
The issue I am having is that the code always gets stuck when preforming the reserve function. I know for a fact that it is getting stuck there because I went through the effort of running this code in a browser and using echo
while commenting out code to see exactly where the code is getting stuck. It's as if an infinit while loop is happening inside the reserve function.
For instance, if I were to comment out $job = $queue->reserve()
, the code would low freely and the page would immediately load, however if I don't comment it out, the circle loading in the browser keeps on going forever.
QUESTION: Why might I be having this problem? Is this normal for the reserve function? Does it just stand waiting for something to appear in the queue? I do actually have the "action_tube"
queue created from a previous script so I would think that the reserve
function would take some of these out. Might the condition of the queue cause a reserve function to stall? Any feedback is greatly appreciated!