json_db: rename "_write" to sth more descriptive
This commit is contained in:
@@ -226,7 +226,7 @@ class JsonDB(Logger):
|
||||
self.data = StoredDict(data, self, [])
|
||||
# write file in case there was a db upgrade
|
||||
if self.storage and self.storage.file_exists():
|
||||
self._write()
|
||||
self.write_and_force_consolidation()
|
||||
|
||||
def load_data(self, s:str) -> dict:
|
||||
""" overloaded in wallet_db """
|
||||
@@ -381,10 +381,10 @@ class JsonDB(Logger):
|
||||
|
||||
@locked
|
||||
def write(self):
|
||||
if not self.storage.file_exists()\
|
||||
or self.storage.is_encrypted()\
|
||||
or self.storage.needs_consolidation():
|
||||
self._write()
|
||||
if (not self.storage.file_exists()
|
||||
or self.storage.is_encrypted()
|
||||
or self.storage.needs_consolidation()):
|
||||
self.write_and_force_consolidation()
|
||||
else:
|
||||
self._append_pending_changes()
|
||||
|
||||
@@ -402,7 +402,7 @@ class JsonDB(Logger):
|
||||
|
||||
@locked
|
||||
@profiler
|
||||
def _write(self):
|
||||
def write_and_force_consolidation(self):
|
||||
if threading.current_thread().daemon:
|
||||
raise Exception('daemon thread cannot write db')
|
||||
if not self.modified():
|
||||
|
||||
Reference in New Issue
Block a user