]> git.etc.gen.nz Git - whoisi.git/commitdiff
Use runInteraction for some more queries.
authorAndrew Ruthven <andrew@etc.gen.nz>
Wed, 24 Jun 2009 00:16:17 +0000 (12:16 +1200)
committerAndrew Ruthven <andrew@cerberus.etc.gen.nz>
Wed, 24 Jun 2009 00:16:17 +0000 (12:16 +1200)
services/command/siterefresh.py

index 4f966659020ee68f0c54d02a5118a17dc04d9357..c1e7f702df9baa643a6c28ff26ef437585cd7289 100644 (file)
@@ -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)