Closed rhettg closed 12 years ago
I've also added to this a pull request a patch that fixes unicode handling.
Previously, if you had a task name that was a unicode string (even if it was ascii encodable), it would fail with a pretty cryptic comment. This bug as wasted my time on two occasions, since I forgot the solution after the first time. Now we have a fix!
But I'll happily take the unicode request, are you too busy with "work" to make it a separate pull request ?
Closing in preference of #21 and #22
I have a worker that I want to exit periodically.
Seemingly the way to do that would be to redefine after_poll() to check if the worker has been running too long, then return False so the worker will exit.
This has a subtle bug however. If the send_complete message has not yet been sent back to the server, the worker may exit before reporting the job's success or failure.
This pull request adds after_job(), which is called each time a job is no longer being handled, providing a much more useful hook for controlling the work loop.
My worker then does something like:
There are no tests included. As far as I can tell (by inserting 'raise Exception()', that loop isn't tested anyway.