Skip to content

Commit

Permalink
yield chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
ppigazzini committed Apr 25, 2024
1 parent 7792324 commit 0f018e0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions server/fishtest/rundb.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ def __init__(self, generator):
def read(self, size=-1):
while size < 0 or len(self.buffer) < size:
try:
self.buffer += next(self.generator)
chunk = next(self.generator)
self.buffer += chunk
result, self.buffer = self.buffer[:size], self.buffer[size:]
yield result
except StopIteration:
break
result, self.buffer = self.buffer[:size], self.buffer[size:]
return result

def close(self):
pass # No cleanup needed, but method is required
Expand Down

0 comments on commit 0f018e0

Please sign in to comment.