Fix local echoes not sent if all threads occupied

This commit is contained in:
miruka 2019-04-19 18:29:25 -04:00
parent aa55ffbc6a
commit 99c06e4034

View File

@ -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(
# 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)