Open GoogleCodeExporter opened 9 years ago
I've modified the backends/beanstalkd.py file as follows:
--- a/lib/queues/backends/beanstalkd.py
+++ b/lib/queues/backends/beanstalkd.py
@@ -31,12 +31,16 @@ class Queue(BaseQueue):
self.backend = 'beanstalkd'
self.name = name
self._connection.use(name)
+ self._connection.watch(name)
def read(self):
try:
- job = self._connection.reserve()
- message = job.body
- job.delete()
+ job = self._connection.reserve(timeout=0)
+ if job:
+ message = job.body
+ job.delete()
+ else:
+ message = None
return message
except (beanstalkc.DeadlineSoon, beanstalkc.CommandFailed, beanstalkc.UnexpectedResponse), e:
raise QueueException, e
Original comment by gregplay...@gmail.com
on 4 Feb 2011 at 3:52
Original issue reported on code.google.com by
gregplay...@gmail.com
on 4 Feb 2011 at 3:50