celery/celery — pull request #1583 by ianawilson (2013-10-18 16:59:04+00:00)
Title: Problem where Celery closed Django db connections as a part of the task_postrun signal, even when a task.request.is_eager

I ran into this problem because we use ``CELERY_ALWAYS_EAGER`` for debugging and testing certain things in our Django app, and my task-calling code was under transaction management. When that code attempted to commit it's savepoint or transaction, the transaction was gone because Celery had closed the db connection as a part of the ``task_postrun`` signal handler that ``DjangoFixup`` registers. This is a fix for that issue, with tests to match.

The only other thing we may want to think about here is whether or not a connection to the cache should be closed or not. I do not believe that you can run into the same problem with the cache, but I am a lot less familiar with expectations here. If it sounds like the same conditional logic should be used to decide if we should call ``DjangoFixup.close_cache()``, that is an easy change and could be a part of this PR.

Lastly, since this is my first contribution to Celery, I've added myself to the contributors / authors.