On 22 helmi, 11:21, Aymeric Augustin <aymeric.augus...@polytechnique.org> wrote: > > Second -- Tasks out of requests. Core developers participating in this > > discussion already have this in mind, Aymeric has commented about it in > >https://code.djangoproject.com/ticket/17887, but it was left out of the > > discussion on the thread. The suggested changes, AFAICT, modify the behavior > > around the end of requests only -- for tasks, nobody closed the connection > > before, and nobody is going to do anything different now; so that's not > > "something missed" either. > > Yes, this patch must not affect behavior outside of the request handler.
The way connections are handled in requests could be useful for task queues, too. The tasks should be separated from each other, so the wanted properties are: - Make sure you have fresh connection state (transaction state for example) per task - Make sure that if a connection is closed inside some task, the connection will be reopened for the next task. - For performance reasons always closing connections after each task isn't wanted. This is exactly what is wanted in request processing, too. For example django-celery does already have their version of persistent connections, see: https://github.com/celery/django-celery/blob/master/djcelery/loaders.py#L84 So, persistent connections will be usable outside request processing as long as they are opt-in. Supporting persistent connections outside request processing isn't needed for the initial implementation, of course. - Anssi -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.