Skip to content

Commit b465820

Browse files
committed
don't flush active pack file that fast
we don't need to ensure all pack entries are written here, cuz all entries are new entries, and we will rollback all of them on failure
1 parent cdcd5b0 commit b465820

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

prime_backup/action/helpers/pack_writer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def append_reader(self, reader: SupportsReadBytes, size: int) -> PackEntryLocati
2525
raise EOFError('reader exhausted with {} bytes remaining'.format(remaining))
2626
self.file.write(buf)
2727
remaining -= len(buf)
28-
self.file.flush()
2928

3029
self.pack.size += size
3130
self.pack.entry_count += 1
@@ -36,7 +35,6 @@ def append_reader(self, reader: SupportsReadBytes, size: int) -> PackEntryLocati
3635

3736
def append_bytes(self, data: bytes) -> PackEntryLocation:
3837
self.file.write(data)
39-
self.file.flush()
4038

4139
offset = self.pack.size
4240
self.pack.size += len(data)
@@ -47,6 +45,7 @@ def append_bytes(self, data: bytes) -> PackEntryLocation:
4745
return PackEntryLocation(self.pack.id, offset)
4846

4947
def close(self):
48+
self.file.flush()
5049
self.file.close()
5150

5251

0 commit comments

Comments
 (0)