nvie/rq — pull request #157 by selwin (2012-11-25 11:43:15+00:00)
Title: Move job perform logic

Hi Vincent,

This moves some logic like setting job status and result expiry from ``worker.perform_job`` to ``job.perform``. Reason for this change is to ensure that job status and results are properly set on synchronous job execution, as outlined by @jtsoi's in issue #143.

Also, would it be better if we move ``worker.default_result_ttl`` to ``queue.default_result_ttl``? That way, a ``Queue`` instance can set a job's ``result_ttl`` if the user doesn't explicitly assign one during job creation.

This will simplify some of the code in ``job.perform`` with the added bonus of keeping ``Worker`` as logic-less as possible. In the future when job concurrency is implemented, the ``Worker`` can concentrate on just distributing jobs to workers without needing to worry about much else.

Let me know what you think.

Best,
Selwin