I have a client setup as follows:

    while True:
        print "Polling"
        try:
            j = connection.reserve()
            print j.data
            print j.Info
            time.sleep(15)
            print "Done sleeping"
            time.sleep(1)
        except Exception, e:
            print e

And i have a producer that adds jobs to my beanstalkd queue with a ttr
of 10 (I have a subclass of Job to set the TTR manually).  I'm
basically trying to see what happens when my client times out.  What
happens, though, is the following:

Polling
55
{'data': {'buries': 0, 'releases': 0, 'tube': 'default', 'timeouts':
0, 'ttr': 10, 'age': 0, 'pri': 0, 'delay': 0, 'state': 'reserved',
'reserves': 1, 'time-left': 9, 'kicks': 0, 'id': 20}, 'state': 'ok',
'bytes': 136}
Done sleeping
Polling
55
Server returned: NOT_FOUND
Polling

So it gets the job the first time, and as expected, it times out, so
when the client finishes its 15 second wait, it starts polling again
and gets the job again, except this time, there is an exception as the
server returns NOT_FOUND.  And the client continues but there doesn't
seem to be any more jobs on the queue.  So my questions are:

1) How is the client even picking up the job the second time if the
job doesn't exist?  The NOT_FOUND message is presumably coming from
the call to j.Info which calls stats-jobs, and according to the
protocol, when this happens, that can only mean that the job doesn't
exist.

2) Why is the server removing the job instead of just releasing it?
>From the protocol, it doesn't seem like this is the expected behavior,
but I'm not sure.  Or is the job still somehow on the queue, just no
longer reservable?

--

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