From 99c06e40341855ec2e6cead2620836d6b04f024a Mon Sep 17 00:00:00 2001 From: miruka Date: Fri, 19 Apr 2019 18:29:25 -0400 Subject: [PATCH] Fix local echoes not sent if all threads occupied --- harmonyqml/backend/client.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/harmonyqml/backend/client.py b/harmonyqml/backend/client.py index c34b3cf4..d6ad886a 100644 --- a/harmonyqml/backend/client.py +++ b/harmonyqml/backend/client.py @@ -183,7 +183,6 @@ class Client(QObject): self._last_typing_set[room_id] = (typing, time.time()) - print("send", typing) self.net.talk( self.nio.room_typing, room_id = room_id, @@ -193,7 +192,6 @@ class Client(QObject): @pyqtSlot(str, str) - @futurize() def sendMarkdown(self, room_id: str, text: str) -> None: html = self.manager.backend.htmlFilter.fromMarkdown(text) content = { @@ -204,9 +202,16 @@ class Client(QObject): } self.messageAboutToBeSent.emit(room_id, content) - self.net.talk( - self.nio.room_send, - room_id = room_id, - message_type = "m.room.message", - content = content, - ) + # If the thread pool workers are all occupied, and @futurize + # wrapped sendMarkdown, the messageAboutToBeSent signal neccessary + # for local echoes would not be sent until a thread is free. + @futurize() + def send(self): + return self.net.talk( + self.nio.room_send, + room_id = room_id, + message_type = "m.room.message", + content = content, + ) + + return send(self)