Hello,

I'm using the pheanstalk PHP client and I'm having problems when
reserving jobs.

Here are the steps I'm currently doing:

1. I run this page first for putting jobs in the queue (10 Jobs):

<?php
require_once ("../pheanstalk/pheanstalk_init.php");


$pheanstalk = new Pheanstalk ("127.0.0.1", "11300");

$pheanstalk->watch("TESTRESERVE")->ignore('default');

for($i=1;$i<=10;$i++){
        $pheanstalk->put($i);
}

unset($pheanstalk);
?>

====================================================

2. Then I run a page that reserves two(2) jobs: This works as
expected.

<?php
require_once ("../pheanstalk/pheanstalk_init.php");

$pheanstalk = new Pheanstalk ("127.0.0.1", "11300");

//RESERVE JOB 1
$pheanstalk->watch("TESTRESERVE")->ignore('default');
$job1 = $pheanstalk->reserve (0);
print "<br>JOB 1: " . $job1->GetData();

unset($pheanstalk);

//RESERVE JOB 2
$pheanstalk = new Pheanstalk ("127.0.0.1", "11300");

$pheanstalk->watch("TESTRESERVE")->ignore('default');

$job2 = $pheanstalk->reserve (0);
print "<br>JOB 2: " . $job2->GetData();
unset($pheanstalk);

?>

====================================================

3. Here's the problem, when I run the third page that reserves another
job, it still gets the first job (Job 1) in the queue although it WAS
ALREADY RESERVED PREVIOUSLY (step 2). This happens also when using
"peek".

<?php
require_once ("../pheanstalk/pheanstalk_init.php");

$pheanstalk = new Pheanstalk ("127.0.0.1", "11300");

$pheanstalk->watch("TESTRESERVE")->ignore('default');

$job3 = $pheanstalk->reserve (0);

print "<br>JOB 3: " . $job3->GetData();

unset($pheanstalk);

?>

The workaround that I'm doing is I "bury" the job as soon as it has
been reserved.

 Is this the expected behavior of the reserve and peek command? Or I
might be missing something here.

Any help is very much appreciated.

Thank you.

Jian

-- 
You received this message because you are subscribed to the Google Groups 
"beanstalk-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/beanstalk-talk?hl=en.

Reply via email to