earl / beanstalkc

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

Bug in Connection#release and Connection#bury #11

Closed rivthor closed 14 years ago

rivthor commented 14 years ago

beastalkc.release(...) is defined to take three parameters - one mandatory and two optional. If the optional parameters are not passed, the command WILL fail.

Example:

from beanstalkc import beanstalkc c=beanstalkc.Connection() a="gorgonzola!" c.put(a) 3 j=c.reserve() j.jid 3 c.release(j.jid) Traceback (most recent call last): File "", line 1, in File "./beanstalkc/beanstalkc.py", line 196, in release self._interact('release %d %d %d\r\n' % (jid, priority, delay), TypeError: %d format: a number is required, not NoneType c.release(j.jid,0,0) c.delete(j.jid)

earl commented 14 years ago

Good catch, thanks! The same is true for Connction#bury (I adapted the bug title accordingly).

earl commented 14 years ago

Now the question is how we want to fix this. Two options:

earl commented 14 years ago

Fix default for the priority parameter in Connection#release and #bury

As Connection#release and #bury are meant to be even more low-level than the respective methods in Job, we keep the priority-preserving magic in Job and just use DEFAULT_PRIORITY as default in Connection.

Closed by e98531254e0ac9bc649fcd559c7df5c1c30a8b07.