Re: Possible bug with transaction.on_commit

2016-05-17 Thread barthelemy
Hi Carl, thanks for your input. I opened a ticket (https://code.djangoproject.com/ticket/26627) and submitted a pull request based on your suggestion: https://github.com/django/django/pull/6617 Bart On Tuesday, May 17, 2016 at 1:52:58 AM UTC-4, Carl Meyer wrote: > > Hi Bart, > > On 05/16/2016

Re: Possible bug with transaction.on_commit

2016-05-16 Thread Carl Meyer
Hi Bart, On 05/16/2016 02:10 PM, barthel...@infobart.com wrote: > I believe that I encountered a bug or at least a serious limitation with > transaction.on_commit in Django 1.9.x. Essentially, the on_commit hooks > seem to be tied to the database connection instead of the transaction. > This means

Re: Possible bug with transaction.on_commit

2016-05-16 Thread barthelemy
The callbacks are indeed run when autocommit is restored, but they are not executed one after the other, i.e., they are not **all** executed when autocommit is restored. The relevant code in Django: # Called by set_autocommit(...) def run_and_clear_commit_hooks(self): self.valida

Re: Possible bug with transaction.on_commit

2016-05-16 Thread Stephen J. Butler
I believe that's as designed. There's this part in the documentation of "Database transactions": Callbacks are not run until autocommit is restored on the connection following the commit (because otherwise any queries done in a callback would open an implicit transaction, preventing the connection

Possible bug with transaction.on_commit

2016-05-16 Thread barthelemy
Hi, I believe that I encountered a bug or at least a serious limitation with transaction.on_commit in Django 1.9.x. Essentially, the on_commit hooks seem to be tied to the database connection instead of the transaction. This means that unrelated transactions may trigger on_commit hooks, which