I want to close all connections to the database, because I develop a long running daemon process:
for connection in connections.all():
connection.close()
But the above code does not work.
select * from pg_stat_activity ; --> There Script is still "idle in transaction"
I found out, that deleting the connection objects solves the problem:
for connection in connections.all():
connection.close() # Der Server braucht keine DB-Verbindung. Ansonsten bleibt die ewig offen.
del(connection.connection)
Has someone seen this before?
Postgres Version 9.0.3
python-psycopg2 2.3.2
--
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment