From 5088019eacdb9c69c32544fefddbdf53c2bcea00 Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Nov 12 2009 21:10:30 +0000 Subject: avoid open transactions between calls --- diff --git a/koji/db.py b/koji/db.py index c28b5f7..0ad2be0 100644 --- a/koji/db.py +++ b/koji/db.py @@ -60,9 +60,12 @@ class DBWrapper: # this DBWrapper is no longer usable after close() if not self.cnx: raise StandardError, 'connection is closed' - self.cnx.rollback() + self.cnx.cursor().execute('ROLLBACK') + #We do this rather than cnx.rollback to avoid opening a new transaction + #If our connection gets recycled cnx.rollback will be called then. self.cnx = None + class CursorWrapper: def __init__(self, cursor, debug=False): self.cursor = cursor