Rev 4891: Change the amount buffered to be a 'constant' that we can get at. in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-proto3-buffering

John Arbash Meinel john at arbash-meinel.com
Tue Dec 15 22:17:18 GMT 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-proto3-buffering

------------------------------------------------------------
revno: 4891
revision-id: john at arbash-meinel.com-20091215221709-h01xw9ud6r7xoc5p
parent: john at arbash-meinel.com-20091211222858-7k63etcp980w0y0b
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0b4-proto3-buffering
timestamp: Tue 2009-12-15 16:17:09 -0600
message:
  Change the amount buffered to be a 'constant' that we can get at.
-------------- next part --------------
=== modified file 'bzrlib/smart/protocol.py'
--- a/bzrlib/smart/protocol.py	2009-12-11 22:28:58 +0000
+++ b/bzrlib/smart/protocol.py	2009-12-15 22:17:09 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007 Canonical Ltd
+# Copyright (C) 2006, 2007, 2008, 2009 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -1062,6 +1062,7 @@
 class _ProtocolThreeEncoder(object):
 
     response_marker = request_marker = MESSAGE_VERSION_THREE
+    BUFFER_SIZE = 1024*1024 # 1 MiB buffer before flushing
 
     def __init__(self, write_func):
         self._buf = []
@@ -1071,7 +1072,7 @@
     def _write_func(self, bytes):
         self._buf.append(bytes)
         self._buf_len += len(bytes)
-        if self._buf_len > 1*1024*1024:
+        if self._buf_len > self.BUFFER_SIZE:
             self.flush()
 
     def flush(self):



More information about the bazaar-commits mailing list