flush + fsync
This commit is contained in:
parent
bc72d96ddb
commit
8be67bf834
@ -1,5 +1,6 @@
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import pickle
|
||||
import threading
|
||||
@ -177,9 +178,14 @@ class DbConnection:
|
||||
self.db2io(bufferdb, buffer)
|
||||
return buffer
|
||||
|
||||
def _file_write(self, line: str):
|
||||
self.__file.write(line)
|
||||
self.__file.flush()
|
||||
os.fsync(self.__file.fileno())
|
||||
|
||||
async def _dump_compressed_buffer(self):
|
||||
buffer = self._compress_buffer()
|
||||
await self.__loop.run_in_executor(None, self.__file.write, buffer.getvalue())
|
||||
await self.__loop.run_in_executor(None, self._file_write, buffer.getvalue())
|
||||
|
||||
async def _do_dump_buffer(self):
|
||||
await self._dump_compressed_buffer()
|
||||
|
Loading…
Reference in New Issue
Block a user