diff bin/rdfdb @ 808:a631e075a5bf

KC big rewrites, now multiple KC instances can sync with rdfdb Ignore-this: 8c75ec3e2bd360c6eb87f7f4d4b3dcc4
author drewp@bigasterisk.com
date Thu, 19 Jul 2012 04:23:06 +0000
parents 6d8f0c088a26
children b19cd005a491
line wrap: on
line diff
--- a/bin/rdfdb	Wed Jul 18 18:08:12 2012 +0000
+++ b/bin/rdfdb	Thu Jul 19 04:23:06 2012 +0000
@@ -95,7 +95,7 @@
 import sys, optparse, logging, json, os
 import cyclone.web, cyclone.httpclient, cyclone.websocket
 sys.path.append(".")
-from light9 import networking, showconfig
+from light9 import networking, showconfig, prof
 from rdflib import ConjunctiveGraph, URIRef, Graph
 from light9.rdfdb.graphfile import GraphFile
 from light9.rdfdb.patch import Patch, ALLSTMTS
@@ -167,9 +167,13 @@
         log.info("patching graph -%d +%d" % (len(p.delQuads), len(p.addQuads)))
 
         patchQuads(self.graph, p.delQuads, p.addQuads, perfect=True)
-        
+        senderUpdateUri = getattr(p, 'senderUpdateUri', None)
         self.summarizeToLog()
         for c in self.clients:
+            print "send to %s? %s %s" % (c, c.updateUri, senderUpdateUri)
+            if c.updateUri == senderUpdateUri:
+                # this client has self-applied the patch already
+                continue
             d = c.sendPatch(p)
             d.addErrback(self.clientErrored, c)
         sendToLiveClients(asJson=p.jsonRepr)
@@ -293,4 +297,4 @@
         
         ], db=db))
     log.info("serving on %s" % port)
-    reactor.run()
+    prof.run(reactor.run, profile=False)