From 3de896d9d60485a63d0386c99737956cfe52ae31 Mon Sep 17 00:00:00 2001 From: jMyles Date: Thu, 22 Aug 2019 09:55:47 +0200 Subject: [PATCH] Bob will learn on the main thread during CLI commands until #1234 is fixed. --- nucypher/network/nodes.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nucypher/network/nodes.py b/nucypher/network/nodes.py index 1f84dbfdf..e78ae1d1b 100644 --- a/nucypher/network/nodes.py +++ b/nucypher/network/nodes.py @@ -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))