[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [UDD] Orphaned packages gatherer keeps on running into errors (Integrity Error inserting bug ...)



Hi,

Andreas Tille wrote:
> Hi folks,
> 
> thanks to Paul one issue was fixed.  Now we are running into the next
> one.  Anybody with some spare time to care for this?

The following patch might help, it follows a stackoverflow
recommendation [1], we want to commit or rollback after each insert.
Note I have not tested it locally, and I have no access to ullmann.

Cheers,
Christophe

  1. http://stackoverflow.com/questions/2209169/using-postgres-in-a-web-app-transaction-aborted-errors?answertab=active#tab-top

---
 udd/orphaned_packages_gatherer.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/udd/orphaned_packages_gatherer.py b/udd/orphaned_packages_gatherer.py
index 0888c41..cae41bf 100644
--- a/udd/orphaned_packages_gatherer.py
+++ b/udd/orphaned_packages_gatherer.py
@@ -16,6 +16,7 @@ class orphaned_packages_gatherer(gatherer):
   def __init__(self, connection, config, source):
     gatherer.__init__(self, connection, config, source)
     self.assert_my_config('bugs-path', 'table', 'unarchived-table')
+    self.connection = connection
 
   title_re = re.compile('^(ITA|RFA|RFH|O): *([^\s]*)([ ]*[-]+[ ]*(.*))?$')
   otime_re = re.compile('^<!-- time:([0-9]+) ')
@@ -63,11 +64,14 @@ class orphaned_packages_gatherer(gatherer):
             cur2.execute("EXECUTE opkgs_insert(%s,%s,%s,%s,%s)", (
               m.group(2), m.group(1), row[0],
               m.group(4), row[2]))
+            self.connection.commit()
           else:
             cur2.execute("EXECUTE opkgs_insert(%s,%s,%s,%s,%s::abstime)", (
               m.group(2), m.group(1), row[0],
               m.group(4), time_orphaned))
+            self.connection.commit()
         except IntegrityError, message:
+          self.connection.rollback()
           print "Integrity Error inserting bug " + str(row[0]) + " " + m.group(2)
           continue
     cur2.execute("ANALYZE %s" % self.my_config['table'])
-- 
2.0.1

Attachment: signature.asc
Description: Digital signature


Reply to: