rate-limit sync progress messages for win32 installs with huge net bufs

This commit is contained in:
Damien Elmes 2010-12-17 21:04:47 +09:00
parent ca07cb8f26
commit 7c45bab35a

View file

@ -74,9 +74,11 @@ def incrementalSend(self, strOrFile):
self.sock.sendall(strOrFile) self.sock.sendall(strOrFile)
else: else:
cnt = 0 cnt = 0
t = time.time()
while 1: while 1:
if sendProgressHook: if sendProgressHook and time.time() - t > 1:
sendProgressHook(cnt) sendProgressHook(cnt)
t = time.time()
data = strOrFile.read(CHUNK_SIZE) data = strOrFile.read(CHUNK_SIZE)
cnt += len(data) cnt += len(data)
if not data: if not data: