diff --git a/src/class_singleWorker.py b/src/class_singleWorker.py index 7c04558b..336c5059 100644 --- a/src/class_singleWorker.py +++ b/src/class_singleWorker.py @@ -71,18 +71,19 @@ class singleWorker(threading.Thread, StoppableThread): self.stop.wait( 10) # give some time for the GUI to start before we start on existing POW tasks. - queryreturn = sqlQuery( - '''SELECT DISTINCT toaddress FROM sent WHERE (status='doingpubkeypow' AND folder='sent')''') - for row in queryreturn: - toaddress, = row - self.requestPubKey(toaddress) - - self.sendMsg() - # just in case there are any pending tasks for msg - # messages that have yet to be sent. - self.sendBroadcast() - # just in case there are any tasks for Broadcasts - # that have yet to be sent. + if shared.shutdown == 0: + queryreturn = sqlQuery( + '''SELECT DISTINCT toaddress FROM sent WHERE (status='doingpubkeypow' AND folder='sent')''') + for row in queryreturn: + toaddress, = row + logger.debug("c: %s", shared.shutdown) + self.requestPubKey(toaddress) + # just in case there are any pending tasks for msg + # messages that have yet to be sent. + self.sendMsg() + # just in case there are any tasks for Broadcasts + # that have yet to be sent. + self.sendBroadcast() while shared.shutdown == 0: command, data = shared.workerQueue.get() diff --git a/src/shared.py b/src/shared.py index ce77da31..23b529cb 100644 --- a/src/shared.py +++ b/src/shared.py @@ -396,6 +396,9 @@ def doCleanShutdown(): shutdown = 1 #Used to tell proof of work worker threads and the objectProcessorThread to exit. broadcastToSendDataQueues((0, 'shutdown', 'no data')) objectProcessorQueue.put(('checkShutdownVariable', 'no data')) + for thread in threading.enumerate(): + if thread.isAlive() and isinstance(thread, StoppableThread): + thread.stopThread() knownNodesLock.acquire() UISignalQueue.put(('updateStatusBar','Saving the knownNodes list of peers to disk...')) @@ -430,9 +433,6 @@ def doCleanShutdown(): time.sleep(.25) from class_outgoingSynSender import outgoingSynSender - for thread in threading.enumerate(): - if thread.isAlive() and isinstance(thread, StoppableThread): - thread.stopThread() for thread in threading.enumerate(): if thread is not threading.currentThread() and isinstance(thread, StoppableThread) and not isinstance(thread, outgoingSynSender): logger.debug("Waiting for thread %s", thread.name)