diff --git a/daemon.py b/daemon.py index 5503fff9..9187166b 100644 --- a/daemon.py +++ b/daemon.py @@ -243,23 +243,8 @@ class PubServer(BaseHTTPRequestHandler): path.startswith('/accounts'): return False return True - - def _postToOutboxThread(self,messageJson: {}) -> bool: - """Creates a thread to send a post - """ - if self.server.outboxThread: - print('Waiting for previous outbox thread to end') - while self.server.outboxThread.isAlive(): - time.sleep(1) - - print('Creating outbox thread') - self.server.outboxThread= \ - threadWithTrace(target=self._postToOutbox, \ - args=(messageJson.copy()),daemon=True) - print('Starting outbox thread') - self.server.outboxThread.start() - def _postToOutbox(self,messageJson: {}) -> bool: + def _postToOutbox(self,messageJson: {},version: str) -> bool: """post is received by the outbox Client to server message post https://www.w3.org/TR/activitypub/#client-to-server-outbox-delivery @@ -440,6 +425,22 @@ class PubServer(BaseHTTPRequestHandler): self.server.projectVersion) return True + def _postToOutboxThread(self,messageJson: {}) -> bool: + """Creates a thread to send a post + """ + if self.server.outboxThread: + print('Waiting for previous outbox thread to end') + while self.server.outboxThread.isAlive(): + time.sleep(1) + + print('Creating outbox thread') + self.server.outboxThread= \ + threadWithTrace(target=self._postToOutbox, \ + args=(messageJson.copy(),__version__),daemon=True) + print('Starting outbox thread') + self.server.outboxThread.start() + return True + def _inboxQueueCleardown(self): """ Check if the queue is full and remove oldest items if it is """