Mercurial > code > home > repos > homeauto
changeset 1505:3cdf76755812
reformat
Ignore-this: e1fe14c4b973c3c1fc2714b988ecc7c8
darcs-hash:055eedef2e8db685f2c524ce4d2b608040d60b33
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Mon, 03 Feb 2020 00:51:18 -0800 |
parents | d8eba5a51c1f |
children | fb62c17633df |
files | lib/patchablegraph/patchablegraph.py |
diffstat | 1 files changed, 6 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/patchablegraph/patchablegraph.py Mon Feb 03 00:50:53 2020 -0800 +++ b/lib/patchablegraph/patchablegraph.py Mon Feb 03 00:51:18 2020 -0800 @@ -71,7 +71,7 @@ }}) patchAsJson = jsonFromPatch # deprecated name - + def patchFromJson(j): body = json.loads(j)['patch'] a = ConjunctiveGraph() @@ -128,7 +128,7 @@ self._observers.append(onPatch) self._currentObservers = len(self._observers) self._observersAdded += 1 - + def removeObserver(self, onPatch): try: self._observers.remove(onPatch) @@ -138,7 +138,7 @@ def setToGraph(self, newGraph): self.patch(Patch.fromDiff(self._graph, newGraph)) - + _sendSimpleGraph = scales.PmfStat('serve/simpleGraph') _sendFullGraph = scales.PmfStat('serve/events/sendFull') _sendPatch = scales.PmfStat('serve/events/sendPatch') @@ -146,7 +146,7 @@ class CycloneGraphHandler(PrettyErrorHandler, cyclone.web.RequestHandler): def initialize(self, masterGraph): self.masterGraph = masterGraph - + def get(self): with self.masterGraph._sendSimpleGraph.time(): writeGraphResponse(self, self.masterGraph, @@ -156,7 +156,7 @@ class CycloneGraphEventsHandler(cyclone.sse.SSEHandler): """ One session with one client. - + returns current graph plus future patches to keep remote version in sync with ours. @@ -180,7 +180,6 @@ # throttle and combine patches here- ideally we could see how # long the latency to the client is to make a better rate choice self.sendEvent(message=patchJson, event=b'patch') - + def unbind(self): self.masterGraph.removeObserver(self.onPatch) -