jsondb: raise an exception if a daemon thread attempts to write
This commit is contained in:
@@ -238,7 +238,7 @@ class QEDaemon(AuthMixin, QObject):
|
|||||||
self._loading = False
|
self._loading = False
|
||||||
self.loadingChanged.emit()
|
self.loadingChanged.emit()
|
||||||
|
|
||||||
threading.Thread(target=load_wallet_task, daemon=True).start()
|
threading.Thread(target=load_wallet_task, daemon=False).start()
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
|
|||||||
@@ -391,8 +391,7 @@ class JsonDB(Logger):
|
|||||||
@locked
|
@locked
|
||||||
def _append_pending_changes(self):
|
def _append_pending_changes(self):
|
||||||
if threading.current_thread().daemon:
|
if threading.current_thread().daemon:
|
||||||
self.logger.warning('daemon thread cannot write db')
|
raise Exception('daemon thread cannot write db')
|
||||||
return
|
|
||||||
if not self.pending_changes:
|
if not self.pending_changes:
|
||||||
self.logger.info('no pending changes')
|
self.logger.info('no pending changes')
|
||||||
return
|
return
|
||||||
@@ -405,8 +404,7 @@ class JsonDB(Logger):
|
|||||||
@profiler
|
@profiler
|
||||||
def _write(self):
|
def _write(self):
|
||||||
if threading.current_thread().daemon:
|
if threading.current_thread().daemon:
|
||||||
self.logger.warning('daemon thread cannot write db')
|
raise Exception('daemon thread cannot write db')
|
||||||
return
|
|
||||||
if not self.modified():
|
if not self.modified():
|
||||||
return
|
return
|
||||||
json_str = self.dump(human_readable=not self.storage.is_encrypted())
|
json_str = self.dump(human_readable=not self.storage.is_encrypted())
|
||||||
|
|||||||
Reference in New Issue
Block a user