# HG changeset patch # User drewp@bigasterisk.com # Date 1653976910 25200 # Node ID be3ee1d50d2829e6827f8238c1088c7714bae490 # Parent 22d52df208aa3678372bc4009a93e32b5d578198 cull some noisy logging, add design note diff -r 22d52df208aa -r be3ee1d50d28 rdfdb/shared_graph.py --- a/rdfdb/shared_graph.py Mon May 30 22:55:29 2022 -0700 +++ b/rdfdb/shared_graph.py Mon May 30 23:01:50 2022 -0700 @@ -83,10 +83,13 @@ while True: ev = await self.watchedGraphs.graphEditEvents.get() now = time.time() - 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! + 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. continue - log.info(f'last wrote file for {ev.uri} {now-self.lastWriteFileToContext.get(ev.uri, 0)} sec ago') + if dt < 10000: + log.info(f'last wrote file for {ev.uri} {dt} sec ago') prev = self.graph.getSubgraph(ev.uri) new = list(ev.content) p = Patch.fromTriplesDiff(prev, new, ev.uri) diff -r 22d52df208aa -r be3ee1d50d28 rdfdb/watched_files.py --- a/rdfdb/watched_files.py Mon May 30 22:55:29 2022 -0700 +++ b/rdfdb/watched_files.py Mon May 30 23:01:50 2022 -0700 @@ -148,6 +148,10 @@ log.error(f'while making WatchEvent for file {p}') raise log.info('--> watchevent with content') + # todo: i now think this is the point we should realize that the content + # is the same as what we 'recently' wrote to the file, and the caller + # should not be bothered with an event. What is 'recently'? If the + # file mtime matches our last write? self.fileEditEvents.put_nowait(FileEditEvent(path=p, content=content)) def _genGoneEvent(self, p: Path):