Really fix leaking dbh.
authorCMDR furrycat <elite@furrycat.net>
Thu, 13 Apr 2017 17:55:36 +0000 (18:55 +0100)
committerCMDR furrycat <elite@furrycat.net>
Thu, 13 Apr 2017 17:55:36 +0000 (18:55 +0100)
plugin/faction/faction.py

index 833a3dd..b6e5711 100644 (file)
@@ -796,10 +796,11 @@ class Faction(DBConnection):
       cursor = self.query('update faction_influence set timestamp=? where checksum=? and eddb_id=? and faction_id>0', [timestamp, checksum, system_id])
       if not cursor.rowcount:
         log.warning('Failed to update timestamp for {} with checksum {}'.format(system, checksum))
+      self.dbh.commit()
     else:
+      self.dbh.commit()
       for system, channel in announce.items():
         await self.report_faction_influence(channel, system = system, update = True, yelp_if_no_data = False)
-    self.dbh.commit()
 
     self.close_db()
     return True