#3394: trac fails to use cached postgresql connection
-------------------------------------------+--------------------------------
Reporter: [EMAIL PROTECTED] | Owner: cmlenz
Type: defect | Status: new
Priority: normal | Milestone:
Component: mod_python frontend | Version: 0.9.6
Severity: major | Resolution:
Keywords: postgresql connection timeout |
-------------------------------------------+--------------------------------
Comment (by [EMAIL PROTECTED]):
Sorry it took so long, but I've finally fixed the problem, in db.py, line
155 where it says:
{{{
if self._dormant:
cnx = self._dormant.pop()
break
}}}
Replace the line:
{{{
break
}}}
With this code:
{{{
try:
cnx.cursor()
break
except Exception:
cnx.close()
}}}
The cnx.cursor() throws an exception if the connection has gone stale, a
dedicated cnx.ping() function would be nicer, though.
I've only tested this with postgresql, but I see no reason it shouldn't
work with any other backend as well.
--
Ticket URL: <http://trac.edgewall.org/ticket/3394>
The Trac Project <http://trac.edgewall.com/>
_______________________________________________
Trac-Tickets mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-tickets