> Specifically, could you try adding `self.needs_rollback = False` at the 
> bottom of the `BaseDatabaseWrapper.rollback()` and tell me if that helps?
>
> Yes, this helps! With this change I can make it work without bypassing the 
public API.

>
>
>
> On 07 Mar 2016, at 12:55, Tore Lundqvist <t...@mima.x.se <javascript:>> 
> wrote:
>
>
> an example of when it happens is when:
>
> Starting with auto commit on.
> transaction.set_autocommit(False)
> ... a lot of time passes without the connection being used so it times 
> out....
> close_old_connections()
>
>
> There’s a long discussion of this use case here: 
> https://code.djangoproject.com/ticket/21597.
>
> Now autocommit is on again. I'm not saying that it's a bug, but it's 
> inconvenient.
>
>
> This surprises me. The connection shouldn’t reopen at all. It should 
> become unusable, for the reasons explained in that issue (ticket 21597).
>
Ticket 21597 seems to be the same problem I have. I Think the timeout 
exception does not aper until you try to use the timed out connection and 
close_old_connections() closes it and solves problem. I guess its a similar 
solution to closing the connection before the time it's not used. You can 
set autocommit to false right after closing the connection, you just have 
to know that closing the connection also resets the autocommit setting. 

>
>
> Given MySQL’s interesting approach to transactional integrity, you can 
> call transaction.set_rollback(False) after a query that failed with an 
> IntegrityError and keep going.
>
 You can't use set_rollback() outside an atomic block so that not an option 
for me.

Thanks

Tore 

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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 https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/34393e05-f7fb-4d58-bc38-d125de2d42bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to