summaryrefslogtreecommitdiff
path: root/client/src
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2016-09-22 01:00:23 -0300
committerVictor Shyba <victor1984@riseup.net>2016-11-18 15:55:52 -0300
commit95ca5c6f7347fb47c6639fd879bb61d2a66852b5 (patch)
tree7c2c4ad68f6e7e8cd103e998506ee9e1c8f67e22 /client/src
parentd378d58f4d30e6745df024d944f6cb372b3493d4 (diff)
[feature] stream content in a separate line
This allow different paths for raw data and metadata, avoiding unnecessary json parsing.
Diffstat (limited to 'client/src')
-rw-r--r--client/src/leap/soledad/client/http_target/send_protocol.py2
-rw-r--r--client/src/leap/soledad/client/http_target/support.py8
2 files changed, 8 insertions, 2 deletions
diff --git a/client/src/leap/soledad/client/http_target/send_protocol.py b/client/src/leap/soledad/client/http_target/send_protocol.py
index c72c6d13..b93a4284 100644
--- a/client/src/leap/soledad/client/http_target/send_protocol.py
+++ b/client/src/leap/soledad/client/http_target/send_protocol.py
@@ -39,7 +39,7 @@ class DocStreamProducer(object):
yield call[0](*call[1:])
while self.producer and not self.stop:
if self.pause:
- yield self.sleep(0.01)
+ yield self.sleep(0.001)
continue
call = self.producer.pop(0)
yield call[0](*call[1:])
diff --git a/client/src/leap/soledad/client/http_target/support.py b/client/src/leap/soledad/client/http_target/support.py
index fe91c5b1..c066331c 100644
--- a/client/src/leap/soledad/client/http_target/support.py
+++ b/client/src/leap/soledad/client/http_target/support.py
@@ -169,7 +169,13 @@ class RequestBody(object):
:return: length of the entry after JSON dumps
:rtype: int
"""
- entry = json.dumps(entry_dict)
+ if 'content' in entry_dict:
+ content = entry_dict['content'] or ''
+ del entry_dict['content']
+ entry = json.dumps(entry_dict)
+ entry = entry + ',\r\n' + content
+ else:
+ entry = json.dumps(entry_dict)
self.entries.append(entry)
def pop(self, amount=10):