Mercurial > code > home > repos > homeauto
comparison service/reasoning/patchsource.py @ 306:6aad04b34231
sse_collector stats page
Ignore-this: 73b6ac46c87bbcca85e7d1ca9127a61c
author | drewp@bigasterisk.com |
---|---|
date | Fri, 16 Sep 2016 01:21:19 -0700 |
parents | 46c5fae89823 |
children | 170dc9b1e789 |
comparison
equal
deleted
inserted
replaced
305:6614416dd2c3 | 306:6aad04b34231 |
---|---|
36 origSet = self._eventSource.protocol.setFinishedDeferred | 36 origSet = self._eventSource.protocol.setFinishedDeferred |
37 def sfd(d): | 37 def sfd(d): |
38 origSet(d) | 38 origSet(d) |
39 d.addCallback(self._onDisconnect) | 39 d.addCallback(self._onDisconnect) |
40 self._eventSource.protocol.setFinishedDeferred = sfd | 40 self._eventSource.protocol.setFinishedDeferred = sfd |
41 | |
42 def stats(self): | |
43 return { | |
44 'url': self.url, | |
45 'fullGraphReceived': self._fullGraphReceived, | |
46 } | |
41 | 47 |
42 def addPatchListener(self, func): | 48 def addPatchListener(self, func): |
43 """ | 49 """ |
44 func(patch, fullGraph=[true if the patch is the initial fullgraph]) | 50 func(patch, fullGraph=[true if the patch is the initial fullgraph]) |
45 """ | 51 """ |
115 self._ps.connectionFailed.addCallback(self._onConnectionFailed) | 121 self._ps.connectionFailed.addCallback(self._onConnectionFailed) |
116 self._ps.connectionLost.addCallback(self._onConnectionLost) | 122 self._ps.connectionLost.addCallback(self._onConnectionLost) |
117 | 123 |
118 def _onPatch(self, p, fullGraph): | 124 def _onPatch(self, p, fullGraph): |
119 self._listener(p, fullGraph=fullGraph) | 125 self._listener(p, fullGraph=fullGraph) |
126 | |
127 def stats(self): | |
128 return { | |
129 'reconnectedPatchSource': self._ps.stats(), | |
130 } | |
120 | 131 |
121 def stop(self): | 132 def stop(self): |
122 self._stopped = True | 133 self._stopped = True |
123 self._ps.stop() | 134 self._ps.stop() |
124 | 135 |