Change beanstalkd default TTR
I am running beanstalkd
as a service using standard /etc/default/beanstalkd
.
Sometimes my code throws an error NOT_FOUND
when trying to delete a job because it was released due to TTR exceeded. I would like to increase the TTR for all jobs that are inserted into the tubes.
Is there a way to set the default TTR for beanstalkd
jobs? I guess I can change this somewhere in / etc / default / beanstalkd, but I couldn't find it in the beanstalkd
docs.
source to share
It is not possible to set a global default in / etc / default / beanstalkd or elsewhere, but it is enough to simply set up a function / wrapper class so that all jobs are carried over to then be inserted into a queue that will set the TTR (parameter to the PUT command). unless specifically set.
In beanstalkc that will replace / replace the function put
.
def put(self, body, priority=DEFAULT_PRIORITY, delay=0, ttr=DEFAULT_TTR):
source to share
It seems to me that you have followed the protocol incorrectly. You need to process DEADLINE_SOON
and do TOUCH
.
What does DEADLINE_SOON mean?
DEADLINE_SOON
is a response to a backup command indicating that you have a reserved job that is due to expire soon (current safety margin is approximately 1 second).
If you get errors DEADLINE_SOON
in the reserve frequently , you should probably consider increasing the TTR on your assignments, as this usually means you haven't finished them over time. It could also be that you are not deleting tasks when you complete them.
For details, see the mailing list mailing list .
How does TTR work?
TTR
applies only to the job at the time it was saved. In this case, the timer (called "time-left" in the job statistics) starts counting from the jobs TTR
.
- If the timer reaches zero, the job is returned to the ready queue.
- If a job is hidden, deleted, or released before the timer expires, the timer ceases to exist.
- If a job is pressed before the timer reaches zero, the timer will start counting from TTR.
"Touch" command
Allows a worker to request more time to work on an assignment. This is useful for jobs that can be time consuming, but you still want the benefits of TTR
pushing the job away from the unresponsive worker. The worker can periodically inform the server that he is still alive and processing work (for example, he can do it on DEADLINE_SOON
). The command postpones the auto release of the reserved job until TTR
seconds after issuing the command.
source to share