guenter/resque — pull request #1 by nelgau (2013-06-24 22:47:39+00:00)
Title: Add process supervision, allow jobs to run after master is down

This pull request makes the following changes:

* When Resque is started via the ```resque:master``` rake task, it forks a group of worker processes (the count of which is given by the ```NUM_WORKERS``` environment variable) and supervises them until the master receives a termination signal.
* Enforces a maximum running time for tasks when the ```MAX_TASK_TIME``` environment variable is set. This is enforced both by the Resque worker and by its child (the process that actually runs the task). On startup, the child creates a sleeping thread that downs the process after the timeout is exceeded. From the other perspective, the workers gives up on the child after the timeout, halting the polling loop that checks for the child's termination, and downs the child by sending the kill signal.
* Removes the code path that supports ruby implementations that don't support forking.
* Removes the code path for pausing workers.
* Allows tasks to continue running after the worker has terminated (but when Resque is running under the process supervisor). Before this change, sending SIGTERM to Resque would abort the task currently in flight. It may not be retried at a later time. **This is a potentially controversial decision. It means that restarting Resque doesn't halt all running jobs.**