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)
|
site_id = self.site_ids.get(site.address)
|
||||||
cur = self.getCursor()
|
cur = self.getCursor()
|
||||||
cur.execute("BEGIN")
|
cur.execute("BEGIN")
|
||||||
self.execute("DELETE FROM peer WHERE site_id = :site_id", {"site_id": site_id})
|
try:
|
||||||
self.cur.cursor.executemany(
|
self.execute("DELETE FROM peer WHERE site_id = :site_id", {"site_id": site_id})
|
||||||
"INSERT INTO peer (site_id, address, port, hashfield, time_added) VALUES (?, ?, ?, ?, ?)",
|
self.cur.cursor.executemany(
|
||||||
self.iteratePeers(site)
|
"INSERT INTO peer (site_id, address, port, hashfield, time_added) VALUES (?, ?, ?, ?, ?)",
|
||||||
)
|
self.iteratePeers(site)
|
||||||
cur.execute("END")
|
)
|
||||||
|
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))
|
site.log.debug("Peers saved in %.3fs" % (time.time() - s))
|
||||||
|
|
||||||
def initSite(self, site):
|
def initSite(self, site):
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Config(object):
|
||||||
|
|
||||||
def __init__(self, argv):
|
def __init__(self, argv):
|
||||||
self.version = "0.5.5"
|
self.version = "0.5.5"
|
||||||
self.rev = 2088
|
self.rev = 2089
|
||||||
self.argv = argv
|
self.argv = argv
|
||||||
self.action = None
|
self.action = None
|
||||||
self.config_file = "zeronet.conf"
|
self.config_file = "zeronet.conf"
|
||||||
|
|
Loading…
Reference in a new issue