add commands "reserve-id" and "put-with-id" to put the job with this id

Author: SiecjeCreated May 8, 2018Updated Jan 29, 2024
LabelsFeatureRequest

Is there a way to get the next job id for a tube? Once the next job id is given it won't be used for the auto generated id. Can provide the job id when you add a job?

I am tracking jobs in a database so I add the job to the database before adding the beanstalk job and then update the database with the beanstalk id.

Add to database without beanstalk id
Add to beanstalkd
# if it fails here there will be a beanstalk job that is not tracked
Update database with beanstalkd id

On recovery if there is a database entry without a beanstalk job it will add a beanstalk job. The beanstalk job will be added twice.

If I add the beanstalk job first when the job is reserved the logic won't be able to find the job in the database since it hasn't been saved in the database yet.