Permalink
Browse files

Allowed the deletion of ready jobs (adapted to protocol change)

  • Loading branch information...
1 parent a5bb653 commit 3ddcc3bca7c38fba8bfe9d7dbae43462a5bdd16c @earl committed Nov 25, 2008
Showing with 12 additions and 6 deletions.
  1. +10 −3 TUTORIAL
  2. +2 −3 beanstalkc.py
View
13 TUTORIAL
@@ -294,16 +294,23 @@ that would be returned by `reserve` -- the next ready job -- use `peek-ready`:
>>> job.body
'yes!'
-Note that you can't delete, release, or bury a job that was not reserved by you.
-Those requests on unreserved jobs are silently ignored:
+Note that you can't release, or bury a job that was not reserved by you. Those
+requests on unreserved jobs are silently ignored:
- >>> job.delete()
>>> job.release()
>>> job.bury()
>>> job.stats()['state']
'ready'
+You can, though, delete a job that was not reserved by you:
+
+ >>> job.delete()
+ >>> job.stats()
+ Traceback (most recent call last):
+ ...
+ CommandFailed: ('NOT_FOUND', [])
+
Finally, you can also peek into the special queues for jobs that are delayed:
>>> beanstalk.put('o tempores', delay=120)
View
5 beanstalkc.py
@@ -176,9 +176,8 @@ def __init__(self, conn, jid, body, reserved=True):
# -- public interface --
def delete(self):
- if self.reserved:
- self.conn.delete(self.jid)
- self.reserved = False
+ self.conn.delete(self.jid)
+ self.reserved = False
def release(self, priority=None, delay=0):
if self.reserved:

0 comments on commit 3ddcc3b

Please sign in to comment.