Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

peek_ready() gets job from 'default' tube even if it's not being watched. #47

Closed
ghedsouza opened this issue Jun 3, 2014 · 2 comments
Closed

Comments

@ghedsouza
Copy link

If you explicitly watch a single empty tube other than 'default', beanstalkc.Connection.peek_ready() will still return jobs from the 'default' tube.

This is an example, where, starting with a completely empty database, peek_ready() should not return a job, but does anyway:

import beanstalkc

beanstalk = beanstalkc.Connection(
    host='127.0.0.1',
    port=11301,
    )

assert beanstalk.using() == 'default'
beanstalk.put('test_job_default')

beanstalk.watch('xxx')
beanstalk.ignore('default')
assert beanstalk.watching() == ['xxx']

job = beanstalk.peek_ready()             # Should not get a job here:
assert job.body == 'test_job_default'

Versions:
beanstalkd = 1.9
beanstalkc = 0.4.0

@ghedsouza
Copy link
Author

If you call beanstalk.use('xxx') before peek_ready(), then it returns None, as expected.

@earl
Copy link
Owner

earl commented Jun 3, 2014

peek_buried, peek_delayed, and peek_ready operate on the currently _use_d tube. Quoting the official protocol documentation:

"The peek commands let the client inspect a job in the system. There are four variations. All but the first operate only on the currently used tube."

This is a gotcha that deserves a mention in our own tutorial documentation as well. There's already an issue tracking that documentation update: #19.

@earl earl closed this as completed Jun 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants