earl / beanstalkc

A simple beanstalkd client library for Python
Apache License 2.0
458 stars 115 forks source link

Can't reserve jobs from a specific tube. #25

Closed sholsapp closed 11 years ago

sholsapp commented 11 years ago

I'm using a snippet like this to put work on a tube in a beanstalk queue:

beanstalk = beanstalkc.Connection(host='localhost', port=11300)
beanstalk.use('built')
output = beanstalk.put('foo')
beanstalk.close() # this hangs

I can see that I'm producing to the tube by stating it. However, upon trying to reserve a job (without timeout) the reserve call hangs. Using peek_ready I can get a handle to the job.

>>> c = beanstalkc.Connection(host='localhost', port=11300)
>>> c.use('built') in c.tubes()
True
>>> c.stats_tube('built')
{'current-jobs-delayed': 0, 'pause': 0, 'name': 'built', 'cmd-pause-tube': 0, 'current-jobs-buried': 0, 'pause-time-left': 0, 'current-waiting': 0, 'current-jobs-ready': 14, 'total-jobs': 14, 'current-watching': 0, 'current-jobs-reserved': 0, 'current-using': 1, 'current-jobs-urgent': 0}
>>> c.reserve()

The exact same code using the default tube works as expected. I can also consume from the tube using telnet. Is this a bug in the library?

sholsapp commented 11 years ago

Use watch before using reserve.