changeset 113:a9d49b297529

logging
author drewp@bigasterisk.com
date Wed, 01 Jun 2022 16:54:12 -0700
parents be3ee1d50d28
children bd3ae09e3312
files rdfdb/shared_graph.py rdfdb/syncedgraph/autodepgraphapi.py rdfdb/syncedgraph/syncedgraph_base.py
diffstat 3 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/rdfdb/shared_graph.py	Mon May 30 23:01:50 2022 -0700
+++ b/rdfdb/shared_graph.py	Wed Jun 01 16:54:12 2022 -0700
@@ -83,13 +83,10 @@
         while True:
             ev = await self.watchedGraphs.graphEditEvents.get()
             now = time.time()
-            dt = now - self.lastWriteFileToContext.get(ev.uri, 0)
-            if dt < .1:
-                # probably a change due to our own write. this should be handled
-                # in watched_files, not here! See watched_files.py _genReadEvent note.
+            if now - self.lastWriteFileToContext.get(ev.uri, 0) < .1:
+                # probably a change due to our own write. this should be handled in watched_files, not here!
                 continue
-            if dt < 10000:
-                log.info(f'last wrote file for {ev.uri} {dt} sec ago')
+            log.info(f'last wrote file for {ev.uri} {now-self.lastWriteFileToContext.get(ev.uri, 0)} sec ago')
             prev = self.graph.getSubgraph(ev.uri)
             new = list(ev.content)
             p = Patch.fromTriplesDiff(prev, new, ev.uri)
--- a/rdfdb/syncedgraph/autodepgraphapi.py	Mon May 30 23:01:50 2022 -0700
+++ b/rdfdb/syncedgraph/autodepgraphapi.py	Wed Jun 01 16:54:12 2022 -0700
@@ -67,7 +67,9 @@
         patch p just happened to the graph; call everyone back who
         might care, and then notice what data they depend on now
         """
-        for func in self._watchers.whoCares(p):
+        whoCares = self._watchers.whoCares(p)
+        log.debug(f'runDepsOnNewPatch: {len(whoCares)} handlers care')
+        for func in whoCares:
             # todo: forget the old handlers for this func
             log.debug('runDepsOnNewPatch calling watcher %s', p.shortSummary())
             self.addHandler(func)
--- a/rdfdb/syncedgraph/syncedgraph_base.py	Mon May 30 23:01:50 2022 -0700
+++ b/rdfdb/syncedgraph/syncedgraph_base.py	Wed Jun 01 16:54:12 2022 -0700
@@ -108,7 +108,6 @@
                 async with sess.ws_connect(self.rdfdbRoot.replace('http://', 'ws://') + 'syncedGraph') as ws:
                     self.ws = ws
                     async for msg in ws:
-                        log.info(f"server sent us {repr(msg)[:200]}")
                         try:
                             self._onIncomingMsg(msg.data)
                         except Exception: