Permalink
Browse files

Use separate sends()'s for revs_difss and bulk_docs in couch-spill.

  • Loading branch information...
steveyen committed Jan 2, 2012
1 parent fe69cdd commit 6c811ebe5affc3f3a200b2a2116732d565a10f1d
Showing with 17 additions and 13 deletions.
  1. +17 −13 couch-spill.py
View
@@ -28,8 +28,6 @@ def run(self):
self.received += len(data)
print data
found = len(re.findall("HTTP/1.1 ", data))
self.inflight -= found
@@ -157,17 +155,23 @@ def flush(self):
revs_diff_arr[2] = str(revs_diff_len) # Fill content length placeholders.
bulk_docs_arr[2] = str(bulk_docs_len)
m = ''.join(revs_diff_arr) + ''.join(bulk_docs_arr)
self.reader.inflight += 2 # For the 2 POST requests.
self.skt.send(m)
self.xfer_sent += len(m)
r = self.reader.received
self.reader_go.set()
self.reader_done.wait()
self.reader_done.clear()
self.xfer_recv += self.reader.received - r
if True:
# Use separate sends()'s for revs_diff and bulk_docs.
to_send = [(''.join(revs_diff_arr), 1), (''.join(bulk_docs_arr), 1)]
else:
# Send revs_diffs + bulk_docs in one send().
to_send = [(''.join(revs_diff_arr) + ''.join(bulk_docs_arr), 2)]
for m, num_posts in to_send:
self.reader.inflight += num_posts
self.skt.send(m)
self.xfer_sent += len(m)
r = self.reader.received
self.reader_go.set()
self.reader_done.wait()
self.reader_done.clear()
self.xfer_recv += self.reader.received - r
self.ops += len(self.queue)
self.queue = []

0 comments on commit 6c811eb

Please sign in to comment.