Hi Mike,

<snip>
>
> Now, I took a guess that if I closed the db connection, the framework
> would open a new one, so I added this to each processing loop.
>
> from django.db import connection
>
> connection.close()
>
> and this seems to work. No more exceptions when the db is restarted.
>
> Now, I could have the service restarted when the db is, but I'm hoping
> for a more elegant solution. I don't like either solution at the
> moment, and I'm looking for recommendations.

Assuming that the DB restarts are rare, consider surrounding your
processing loop with a try..except block. When the exception occurs,
close the current connection so that the next iteration of your loop
gets a fresh connection. This way, you can reuse one connection as
long as it continues to work.

-Rajesh D

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to