diff --git a/src/class_singleWorker.py b/src/class_singleWorker.py index 0190e1c5..87034f7c 100644 --- a/src/class_singleWorker.py +++ b/src/class_singleWorker.py @@ -51,6 +51,11 @@ class singleWorker(threading.Thread, StoppableThread): super(singleWorker, self).stopThread() 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( diff --git a/src/class_sqlThread.py b/src/class_sqlThread.py index b46a570f..9bd7e8e7 100644 --- a/src/class_sqlThread.py +++ b/src/class_sqlThread.py @@ -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': diff --git a/src/state.py b/src/state.py index 3d5209c4..c7b79e07 100644 --- a/src/state.py +++ b/src/state.py @@ -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