earl / beanstalkc

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

Unexpected errors for put #40

Closed JensRantil closed 10 years ago

JensRantil commented 10 years ago

I notice that put(...) only lists ['JOB_TOO_BIG'] as expected errors. Have I missunderstood things or shouldn't it also contain BURIED?

Doerge commented 10 years ago

True. beanstalkd spec:

After sending the command line and body, the client waits for a reply, which
may be:

 - "INSERTED <id>\r\n" to indicate success.

   - <id> is the integer id of the new job

 - "BURIED <id>\r\n" if the server ran out of memory trying to grow the
   priority queue data structure.

   - <id> is the integer id of the new job

 - "EXPECTED_CRLF\r\n" The job body must be followed by a CR-LF pair, that is,
   "\r\n". These two bytes are not counted in the job size given by the client
   in the put command line.

 - "JOB_TOO_BIG\r\n" The client has requested to put a job with a body larger
   than max-job-size bytes.

 - "DRAINING\r\n" This means that the server has been put into "drain mode"
   and is no longer accepting new jobs. The client should try another server
   or disconnect and try again later.

I would say that a BURIED response require special handling by the 'putter'. The job won't execute.

earl commented 10 years ago

Right! Thanks for the report, @JensRantil, and thanks for the fix, @Doerge. The fix also addresses DRAINING, which was similarly incorrect.

JensRantil commented 10 years ago

Just wanted to give a heads up and thank you all for a quick fix. :+1: