You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While there is plenty of information how to interact with Beanstalk I could not find details regarding how to implement a production grade worker with beaneater.
Mainly I'm concerned with how to stop a worker gracefully when, for example, it is restarted/stopped via systemd. As far as my understanding is I will want to let the worker finish it's job before I stop it. How can I accomplish this?
My current approach looks like this. It works if the worker is currently doing work, it will stop after the job. But if the worker is currently doing nothing it will stop only after the next job is processed. What am I doing wrong?
Thanks for your help.
#!/usr/bin/env rubyrequire'rubygems'require'bundler/setup'require'beaneater'beanstalk=Beaneater.new'127.0.0.1:11300'tube_name="app.default"beanstalk.jobs.register(tube_name)do |job|
# Do the actual work.endtrap'SIGTERM'dobeanstalk.jobs.stop!endtrap'SIGINT'dobeanstalk.jobs.stop!endbeanstalk.jobs.process!beanstalk.close
The text was updated successfully, but these errors were encountered:
I came up with another solution but stumbled into something like a deadlock. What am I doing wrong @nesquena ?
When I send a SIGTERM to the worker it tries to stop but the tube.put "-" somehow causes a deadlock? The output is "hi", "step 1", "step 2" but never reaches the next puts since it somehow hangs when it puts the job.
While there is plenty of information how to interact with Beanstalk I could not find details regarding how to implement a production grade worker with beaneater.
Mainly I'm concerned with how to stop a worker gracefully when, for example, it is restarted/stopped via systemd. As far as my understanding is I will want to let the worker finish it's job before I stop it. How can I accomplish this?
My current approach looks like this. It works if the worker is currently doing work, it will stop after the job. But if the worker is currently doing nothing it will stop only after the next job is processed. What am I doing wrong?
Thanks for your help.
The text was updated successfully, but these errors were encountered: