diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2016-09-22 01:00:23 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2016-12-12 09:11:59 -0200 |
commit | 7680ec18f26ce6bab48c8a57a05e08cba7c6ba5e (patch) | |
tree | 12b8478e6ae9c23a1dc8c68269f66be9a4df8f6b /client/src/leap/soledad | |
parent | a302322e53878a6212532d33ac0a0f9e0c34b176 (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/leap/soledad')
-rw-r--r-- | client/src/leap/soledad/client/http_target/send_protocol.py | 2 | ||||
-rw-r--r-- | client/src/leap/soledad/client/http_target/support.py | 8 |
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): |