From 6959bba5f3889e0661d6f586f2d0cde28915323b Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 16 Sep 2019 15:49:03 +0100 Subject: [PATCH] move getting private_key/our_actor to __init__ (for main thread) --- modules/fediverse/ap_server.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/fediverse/ap_server.py b/modules/fediverse/ap_server.py index 0df2eac5..f408b8e0 100644 --- a/modules/fediverse/ap_server.py +++ b/modules/fediverse/ap_server.py @@ -12,12 +12,6 @@ class Server(object): self.username = username self.instance = instance - self._request_queue = queue.Queue() - self._request_thread = threading.Thread(target=self._request_loop) - self._request_thread.daemon = True - self._request_thread.start() - - def _request_loop(self): url_for = self.exports.get_one("url-for") key_id = self._ap_keyid_url(url_for) @@ -28,6 +22,14 @@ class Server(object): del url_for + self._request_queue = queue.Queue() + self._request_thread = threading.Thread(target=self._request_loop, + args=(private_key, our_actor)) + self._request_thread.daemon = True + self._request_thread.start() + + def _request_loop(self, private_key, our_actor): + while True: obj = self._request_queue.get() if obj == "kill":