Fix peer server thread shutdown (#903)

This commit is contained in:
Jonathan Zernik 2021-08-10 18:48:00 -07:00 committed by GitHub
parent 7d266cdf5e
commit 36d89bd25e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 53 additions and 10 deletions

View file

@ -13,6 +13,7 @@ class ProcessReceivedPaymentsWorker:
threading.Thread(
target=self.process_subscribed_invoices,
# daemon=True,
name="process_received_payments_thread",
).start()
def process_subscribed_invoices(self):

View file

@ -143,6 +143,9 @@ class SqueakNode:
def stop_running(self):
self.stopped.set()
# TODO: Use explicit stop to stop all components
self.peer_server.stop()
def load_lightning_client(config) -> LNDLightningClient:
return LNDLightningClient(

View file

@ -22,6 +22,7 @@ class SqueakOfferExpiryWorker:
self.start_running,
)
timer.daemon = True
timer.name = "squeak_offer_expiry_thread"
timer.start()
self.remove_expired_offers()

View file

@ -17,6 +17,7 @@ class SqueakPeerSyncWorker:
def sync_timeline(self):
logger.info("Syncing timeline with peers...")
self.print_running_threads()
self.squeak_controller.sync_timeline()
self.squeak_controller.share_squeaks()
@ -27,5 +28,10 @@ class SqueakPeerSyncWorker:
self.start_running,
)
timer.daemon = True
timer.name = "squeak_peer_sync_thread"
timer.start()
self.sync_timeline()
def print_running_threads(self):
for thread in threading.enumerate():
print(thread.name)