Bob will learn on the main thread during CLI commands until #1234 is fixed.

pull/2712/head
jMyles 2019-08-22 09:55:47 +02:00
parent 70952329c3
commit 3de896d9d6
1 changed files with 2 additions and 0 deletions

View File

@ -660,6 +660,8 @@ class Learner:
if (round_finish - start).seconds > timeout:
if not self._learning_task.running:
raise RuntimeError("Learning loop is not running. Start it with start_learning().")
elif not reactor.running and not learn_on_this_thread:
raise RuntimeError(f"The reactor isn't running, but you're trying to use it for discovery. You need to start the Reactor in order to use {self} this way.")
else:
raise self.NotEnoughNodes("After {} seconds and {} rounds, didn't find {} nodes".format(
timeout, rounds_undertaken, number_of_nodes_to_know))