From e7e710bb3633d52d9fedecffa138abe4a6c1fd3b Mon Sep 17 00:00:00 2001 From: jMyles Date: Fri, 17 Jul 2020 19:36:57 -0700 Subject: [PATCH] Stop Alice's publication threadpool in disenchant(). --- nucypher/characters/lawful.py | 6 +++++- tests/fixtures.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/nucypher/characters/lawful.py b/nucypher/characters/lawful.py index 7342bb5ca..b3c952f36 100644 --- a/nucypher/characters/lawful.py +++ b/nucypher/characters/lawful.py @@ -133,7 +133,6 @@ class Alice(Character, BlockchainPolicyAuthor): self.publication_threadpool = ThreadPool(maxthreads=120, name="Alice Policy Publication") # In the future, this value is perhaps best set to something like 3-4 times the optimal "high n", whatever we determine that to be. self.publication_threadpool.start() - reactor.addSystemEventTrigger("before", "shutdown", self.publication_threadpool.stop) # TODO: Congregate Character Stop activity. else: self.m = STRANGER_ALICE self.n = STRANGER_ALICE @@ -445,6 +444,11 @@ class Alice(Character, BlockchainPolicyAuthor): return controller + def disenchant(self): + super().disenchant() + self.publication_threadpool.stop() + + class Bob(Character): banner = BOB_BANNER diff --git a/tests/fixtures.py b/tests/fixtures.py index f1a1a7f2e..90686723d 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -344,14 +344,14 @@ def random_policy_label(): def federated_alice(alice_federated_test_config): alice = alice_federated_test_config.produce() yield alice - alice.publication_threadpool.stop() + alice.disenchant() @pytest.fixture(scope="module") def blockchain_alice(alice_blockchain_test_config, testerchain): alice = alice_blockchain_test_config.produce() yield alice - alice.publication_threadpool.stop() + alice.disenchant() @pytest.fixture(scope="module")