Beanstalkd: support reserving a specific job by id

Created on 3 Apr 2016  路  11Comments  路  Source: beanstalkd/beanstalkd

Idea:

reserve-job <id>

Output:

RESERVED <id> <bytes>\r\n
<data>\r\n

or

ALREADY_RESERVED\r\n

or

NOT_FOUND\r\n

This would fix #109 and #20 and lots of other cases where one would like to modify a job. The ALREADY_RESERVED would make sure that noone is processing the job, before I modify it.

I don't know the code (yet), would it be somewhat efficient to execute reserve-job <id>?

FeatureRequest Help Wanted NeedsFix

Most helpful comment

This is an excellent idea.

One orthogonal new feature that combines with the rest of the system to make several other commands more powerful.

Regarding the semantics, I kind of think it would be good to have this command get the job not just from the ready queue, but from anywhere (delay, buried) as long as the job isn't reserved by another connection. That would let clients also change the delay time (including to 0) of delayed jobs, and to unbury specific jobs. (That is, if we had had reserve-job from the beginning, we wouldn't have needed things like #120 kick-job.)

All 11 comments

This would also fix #170.

This would allow #222 to reserve a job, delete it and create it using a different delay.

I think @kr should approve or not the specs in case he believes will add a benefit to the project. For example I'm ok to spend my time in implementing/fixing different bugs but It will be a waste of time to work on something and to not receive any feedback.

This would be great @kr. It would allow the following use case:

  • Web page displays a list of 50 "things" to review. Reserve all 50 things for the current user
  • User looks at all the things on web page and clicks "approve", which makes a call to the backend
  • Backend reserves the jobs again and deletes them.
  • If user doesn't approve things fast enough, the jobs go back in the queue.

I'm not sure if this use case is currently possible since the beanstalk connection will likely be different for every request (displaying the web page, and approving the things)

If @kr approves the specs I can implement this . Is not so complicated

Anyone hear from @kr?

This might fix #240 as well by following sequence of commands:

  • reserve-job id-of-a-job-to-move
  • put job parameters...

This is an excellent idea.

One orthogonal new feature that combines with the rest of the system to make several other commands more powerful.

Regarding the semantics, I kind of think it would be good to have this command get the job not just from the ready queue, but from anywhere (delay, buried) as long as the job isn't reserved by another connection. That would let clients also change the delay time (including to 0) of delayed jobs, and to unbury specific jobs. (That is, if we had had reserve-job from the beginning, we wouldn't have needed things like #120 kick-job.)

it would be good to have this command get the job not just from the ready queue, but from anywhere

Yes, this is what I had in my mind too.

Also I would not introduce the ALREADY_RESERVED response and instead keep using NOT_FOUND for reserved jobs. What is the benefit for the client to know that the job was already reserved? Retry does not make sense because most likely the job will be processed or moved with some new id. Also, changing the response to this command means that we need to fix it for other commands for consistency, and that would definitely break the protocol for existing client libs.

@tw99, please read the comments above.

I am on it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kr picture kr  路  16Comments

raju-divakaran picture raju-divakaran  路  3Comments

ysmolsky picture ysmolsky  路  10Comments

vitlav picture vitlav  路  10Comments

ysmolsky picture ysmolsky  路  15Comments