From: Andrew Ruthven Date: Wed, 24 Jun 2009 00:16:17 +0000 (+1200) Subject: Use runInteraction for some more queries. X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3898b39e59e0f7f464ebc24e7068da4e75a091f;p=whoisi.git Use runInteraction for some more queries. --- diff --git a/services/command/siterefresh.py b/services/command/siterefresh.py index 4f96665..c1e7f70 100644 --- a/services/command/siterefresh.py +++ b/services/command/siterefresh.py @@ -105,7 +105,7 @@ class RefreshSiteError: q = """ UPDATE site_refresh set status = 'done', error = 'http_not_modified' where id = %s """ - d = self.dcm.runQuery(q, [ id ]) + d = self.dcm.runInteraction(self.newInteraction, q, [ id ]) d.addCallback(self.modifiedUpdateDone) d.addErrback(self.updateFailed) return self.d @@ -116,7 +116,7 @@ class RefreshSiteError: error = str(failure) - d = self.dcm.runQuery(q, (error, id)) + d = self.dcm.runInteraction(self.newInteraction, q, (error, id)) d.addCallback(self.updateDone) d.addErrback(self.updateFailed) @@ -128,10 +128,14 @@ class RefreshSiteError: q = """ UPDATE site SET last_poll = %s WHERE id = %s """ - d = self.dcm.runQuery(q, (datetime.datetime.utcnow(), site_id)) + d = self.dcm.runInteraction(self.newInteraction, q, (datetime.datetime.utcnow(), site_id)) d.addCallback(self.updateDone) d.addErrback(self.updateFailed) + + def newInteraction(self, trans, *args): + trans.execute(*args) + def updateDone(self, *args, **kw): if self.it_failed: self.d.errback(self.orig_failure)