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>?
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:
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-moveput 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.
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.)