PoW Worker should wait for sql thread to init

- I think this was causing freezing queue on launch if not empty
- I can't reproduce the bug anymore
This commit is contained in:
Peter Šurda 2017-02-26 20:44:56 +01:00
parent d8301ff512
commit 511b89ebbe
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
3 changed files with 9 additions and 0 deletions

View File

@ -52,6 +52,11 @@ class singleWorker(threading.Thread, StoppableThread):
def run(self):
while not state.sqlReady and state.shutdown == 0:
self.stop.wait(2)
if state.shutdown > 0:
return
# Initialize the neededPubkeys dictionary.
queryreturn = sqlQuery(
'''SELECT DISTINCT toaddress FROM sent WHERE (status='awaitingpubkey' AND folder='sent')''')

View File

@ -494,6 +494,8 @@ class sqlThread(threading.Thread):
parameters = (int(time.time()),)
self.cur.execute(item, parameters)
state.sqlReady = True
while True:
item = helper_sql.sqlSubmitQueue.get()
if item == 'commit':

View File

@ -19,6 +19,8 @@ shutdown = 0 #Set to 1 by the doCleanShutdown function. Used to tell the proof o
curses = False
sqlReady = False # set to true by sqlTread when ready for processing
# If the trustedpeer option is specified in keys.dat then this will
# contain a Peer which will be connected to instead of using the
# addresses advertised by other peers. The client will only connect to