qml: use daemon threads everywhere the network is involved

The app hangs indefinitely if we try to quit it while one of
these threads is active, because once asyncio has shut down,
futures never return. This was already fixed for lightning
payments in c5dc133, but there are many other cases.
This commit is contained in:
ThomasV
2023-04-05 12:26:32 +02:00
parent 0c83f363eb
commit d4c386a62c
5 changed files with 7 additions and 7 deletions

View File

@@ -265,7 +265,7 @@ class QEAppController(BaseCrashReporter, QObject):
self.sendingBugreportSuccess.emit(text)
self.sendingBugreport.emit()
threading.Thread(target=report_task).start()
threading.Thread(target=report_task, daemon=True).start()
@pyqtSlot()
def showNever(self):

View File

@@ -194,7 +194,7 @@ class QEChannelDetails(QObject, QtEventListener):
self._logger.exception("Could not close channel: " + repr(e))
self.channelCloseFailed.emit(_('Could not close channel: ') + repr(e))
threading.Thread(target=do_close).start()
threading.Thread(target=do_close, daemon=True).start()
@pyqtSlot()
def deleteChannel(self):

View File

@@ -216,7 +216,7 @@ class QEChannelOpener(QObject, AuthMixin):
self._logger.debug('starting open thread')
self.channelOpening.emit(conn_str)
threading.Thread(target=open_thread).start()
threading.Thread(target=open_thread, daemon=True).start()
# TODO: it would be nice to show this before broadcasting
#if chan.has_onchain_backup():

View File

@@ -587,7 +587,7 @@ class QEInvoiceParser(QEInvoice):
except Exception as e:
self.validationError.emit('lnurl', repr(e))
threading.Thread(target=resolve_task).start()
threading.Thread(target=resolve_task, daemon=True).start()
def on_lnurl(self, lnurldata):
self._logger.debug('on_lnurl')
@@ -635,7 +635,7 @@ class QEInvoiceParser(QEInvoice):
self._logger.error(repr(e))
self.lnurlError.emit('lnurl', str(e))
threading.Thread(target=fetch_invoice_task).start()
threading.Thread(target=fetch_invoice_task, daemon=True).start()
def on_lnurl_invoice(self, orig_amount, invoice):
self._logger.debug('on_lnurl_invoice')

View File

@@ -350,7 +350,7 @@ class QESwapHelper(AuthMixin, QObject):
self._logger.error(str(e))
self.swapFailed.emit(str(e))
threading.Thread(target=swap_task).start()
threading.Thread(target=swap_task, daemon=True).start()
def do_reverse_swap(self, lightning_amount, onchain_amount):
if lightning_amount is None or onchain_amount is None:
@@ -375,7 +375,7 @@ class QESwapHelper(AuthMixin, QObject):
self._logger.error(str(e))
self.swapFailed.emit(str(e))
threading.Thread(target=swap_task).start()
threading.Thread(target=swap_task, daemon=True).start(d)
@pyqtSlot()
@pyqtSlot(bool)