chrisboulton / php-resque

PHP port of resque (Workers and Queueing)
MIT License
3.43k stars 759 forks source link

Correctly restart the workers #300

Closed earnaway closed 8 years ago

earnaway commented 8 years ago

Is there a recommended way to restart the workers for long running workers? I'm using supervisor to start my resque workers, and I could just kill all the processes and let supervisor start them again, but wondering if there was any recommended way to restart the workers to pick up any code changes that I've made for example.

rajibahmed commented 8 years ago

AFIAK there is no recommended way. I used to kill php cli , that used to kill the workers.

danhunsaker commented 8 years ago

Check the signals section of the docs. One of the signals instructs the worker to shut down after finishing the current job. This is the recommended way to stop a worker, as you don't have any incomplete jobs left behind this way.

earnaway commented 8 years ago

Thanks, I tried sending signals to the process and that works just as I wanted. Cheers.

rajibahmed commented 8 years ago

Apologies for providing wrong information :(

danhunsaker commented 8 years ago

It wasn't wrong. Just wasn't the specific signal they were looking for. :)

earnaway commented 8 years ago

No worries @rajibahmed, that'll still work under some conditions, but could create issues in other situations. Since I'm using supervisor, I could just send a signal to terminate as @danhunsaker mentioned, and supervisor will cause a new process worker to start up, which solved my question :)