Skip to content
Snippets Groups Projects
Commit 0c397c63 authored by ale's avatar ale
Browse files

start workers after data is loaded

parent 91ae5732
Branches
Tags v0.1.2
No related merge requests found
......@@ -358,20 +358,22 @@ class StateMachine(object):
def run(self):
input_queue = Queue.Queue()
self.threads = [
StateMachineWorker(self, input_queue, i + 1)
for i in xrange(self.num_workers)]
[x.start() for x in self.threads]
stats_thread = StatsThread(self)
stats_thread.start()
self.running = True
# Inject initial state.
with readonly_transaction(self.db) as session:
for key in self.db.scan(session):
input_queue.put(key)
# Start the workers after all the data has been loaded.
[x.start() for x in self.threads]
self.running = True
# Wait until everything is done.
while True:
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment