I haven't seen one. It would be a welcome contribution!
kr
Awesome. I'm really looking forward to this, Tim. Thanks.
kr
Thanks! I'll add a link from the beanstalkd page right away.
After a quick glance, I noticed something that looks like a typo on
lines 532 and 533. I think that
$this->mode = self::DRAINING;
return self::DRAINING;
ought to say
$this->mode = self::MODE_DRAINING;
return self::MODE_DRAINING;
Otherwise it looks great!
Thanks again.
kr
Awesome! Thanks Tim. Just before I sat down to catch up on my groups,
I was thinking how useful a PHP beanstalk client could be for me this
week. One question tho: how did you know? :)
Thanks for spotting that. I actually encountered this early yesterday
and committed it to SVN hehehe. I just haven't had the time to roll a
new package.
Is it working well in other respects?
Tim
--
I may have lost my way now
Haven't forgotten my way home
But no stress tests for the moment.
Ludo
Thanks for pointing that out. I need to roll a new release soon, just
havent had the spare time.
Regarding your questions, I think it's just a misunderstanding.
$beanstalk refers to a pool of servers, and is represented by the
BeanStalk class. Calling peek_ready() on $beanstalk expects a server
name and optional writeback.
$beanstalk then routes the peek_ready() call internally to an actual
server instance, represented by a BeanQueue object. THIS peek_ready()
does not need a servername parameter, and therefore only accepts the
writeback.
Since array_shift modified the passed array, the top level
peek_ready() only sends the writeback to the internal peek_ready, as
the servername as already been shifted off.
Does that make sense?
- Tim
Yeah this is an issue with beanstalk clients like mine, and beanstalkd
1.0. I was trying to implement a polling check that could pull the
next ready job from a pool, but peek() didn't turn out to work as I
initially expected.
Avoid the peek modes for now. Stick to 'sequential wait' and 'random
wait' select values.
I will release v1.1 of my client shortly, and then the peek modes will
work again, as expected.
Hi,
I ran into same problems at the beginning. Then I switched to
sequential peek method:
$beanstalk = BeanStalk::open(
array(
'servers' => array(
'192.168.1.40:11300',
),
'select' => 'sequential peek',
'peek_usleep' => 2500, // 2.5 ms
)
);
and no 100% CPU problem now.
Hope it helps,
Ludo