changeset 1121:812c0ded674e

patchsource accept much longer lines from sse_collector Ignore-this: 712d52cecf99c82afffc1ab6b58a5b4f darcs-hash:f12ebc03f603e3fed7c5821e24813f7e70de46dd
author drewp <drewp@bigasterisk.com>
date Fri, 25 Nov 2016 17:56:26 -0800
parents ba0cec7e1ac9
children 9cb135126a63
files service/reasoning/sse_collector.py service/reasoning/twisted_sse_demo/sse_client.py
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/service/reasoning/sse_collector.py	Wed Oct 12 18:37:41 2016 -0700
+++ b/service/reasoning/sse_collector.py	Fri Nov 25 17:56:26 2016 -0800
@@ -274,6 +274,10 @@
             p = self.statements.makeSyncPatch(h, self._sourcesForHandler(h))
             if not p.isNoop():
                 log.debug("send patch %s to %s", p.shortSummary(), h)
+                # This can be a giant line, which was a problem once. Might be 
+                # nice for this service to try to break it up into multiple sends,
+                # although there's no guarantee at all since any single stmt 
+                # could be any length.
                 h.sendEvent(message=jsonFromPatch(p), event='patch')
                 
     def addSseHandler(self, handler):
--- a/service/reasoning/twisted_sse_demo/sse_client.py	Wed Oct 12 18:37:41 2016 -0700
+++ b/service/reasoning/twisted_sse_demo/sse_client.py	Fri Nov 25 17:56:26 2016 -0800
@@ -3,12 +3,17 @@
 
 class EventSourceProtocol(LineReceiver):
     def __init__(self):
+        self.MAX_LENGTH = 16384 * 8
         self.callbacks = {}
         self.finished = None
         # Initialize the event and data buffers
         self.event = 'message'
         self.data = ''
 
+    def lineLengthExceeded(self, line):
+        print "line too long"
+        raise NotImplementedError
+
     def setFinishedDeferred(self, d):
         self.finished = d