nvie/rq — pull request #102 by selwin (2012-07-25 03:09:51+00:00)
Title: Worker now sends a "shutdown job" on warm shutdown

Hi @nvie,

This is a quick and dirty patch attempting to solve the warm shutdown issue as discussed on https://github.com/nvie/rq/issues/48 .

I'm not sure how write a test to verify shutdowns due to how the code is structured, but this is the output from my test:

```
>>> w.work()
[2012-07-25 02:49] DEBUG: worker: Registering birth of worker selwin
[2012-07-25 02:49] INFO: worker:
[2012-07-25 02:49] INFO: worker: *** Listening on default...
^C[2012-07-25 02:49] DEBUG: worker: Got SIGINT signal.
[2012-07-25 02:49] WARNING: worker: Warm shut down. Press Ctrl+C again for a cold shutdown.
[2012-07-25 02:49] DEBUG: worker: Stopping after current horse is finished.
[2012-07-25 02:49] INFO: worker: default: rq.worker.stop_worker() (f5e087b1-edcf-4827-9371-960e7a604e96)
[2012-07-25 02:49] INFO: horse: Job OK
[2012-07-25 02:49] INFO: worker: Stopping on request.
[2012-07-25 02:49] DEBUG: worker: Registering death
```