mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-30 19:21:17 +00:00
Smarter buffer handling.
This commit is contained in:
parent
8416de6219
commit
ef4a035e53
1 changed files with 5 additions and 2 deletions
|
@ -40,7 +40,7 @@ def __iter__(self):
|
|||
self.full_sum = True
|
||||
self.extra = None
|
||||
self.done = False
|
||||
self.buf_size = self.chunk_size * 3
|
||||
self.buf_size = self.chunk_size * 10
|
||||
return self
|
||||
|
||||
def next(self):
|
||||
|
@ -51,8 +51,11 @@ def next(self):
|
|||
self.done = True
|
||||
return self.extra
|
||||
while True:
|
||||
if self.i > self.buf_size - self.chunk_size:
|
||||
self.data = self.data[self.i - o:]
|
||||
self.i = o
|
||||
if len(self.data) - self.i < self.chunk_size:
|
||||
self.data += self.fd.read(self.chunk_size * 3)
|
||||
self.data += self.fd.read(self.buf_size - len(self.data))
|
||||
if len(self.data) == self.i:
|
||||
raise StopIteration
|
||||
if self.full_sum or len(self.data) - self.i < self.chunk_size:
|
||||
|
|
Loading…
Reference in a new issue