Rev2089, Close the transaction on failed peer db save
This commit is contained in:
parent
b73742839b
commit
b0d574dfb0
2 changed files with 11 additions and 7 deletions
|
@ -73,12 +73,16 @@ class ContentDbPlugin(object):
|
|||
site_id = self.site_ids.get(site.address)
|
||||
cur = self.getCursor()
|
||||
cur.execute("BEGIN")
|
||||
self.execute("DELETE FROM peer WHERE site_id = :site_id", {"site_id": site_id})
|
||||
self.cur.cursor.executemany(
|
||||
"INSERT INTO peer (site_id, address, port, hashfield, time_added) VALUES (?, ?, ?, ?, ?)",
|
||||
self.iteratePeers(site)
|
||||
)
|
||||
cur.execute("END")
|
||||
try:
|
||||
self.execute("DELETE FROM peer WHERE site_id = :site_id", {"site_id": site_id})
|
||||
self.cur.cursor.executemany(
|
||||
"INSERT INTO peer (site_id, address, port, hashfield, time_added) VALUES (?, ?, ?, ?, ?)",
|
||||
self.iteratePeers(site)
|
||||
)
|
||||
except Exception, err:
|
||||
site.log.error("Save peer error: %s" % err)
|
||||
finally:
|
||||
cur.execute("END")
|
||||
site.log.debug("Peers saved in %.3fs" % (time.time() - s))
|
||||
|
||||
def initSite(self, site):
|
||||
|
|
|
@ -10,7 +10,7 @@ class Config(object):
|
|||
|
||||
def __init__(self, argv):
|
||||
self.version = "0.5.5"
|
||||
self.rev = 2088
|
||||
self.rev = 2089
|
||||
self.argv = argv
|
||||
self.action = None
|
||||
self.config_file = "zeronet.conf"
|
||||
|
|
Loading…
Reference in a new issue