mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-02-25 00:59:58 -05:00
daemon: Create a method to send messages to the UI thread.
This commit is contained in:
parent
ed71fdedb2
commit
dfa5501a6c
@ -132,7 +132,7 @@ class ProxyDaemon:
|
|||||||
self.pan_clients[user_id] = pan_client
|
self.pan_clients[user_id] = pan_client
|
||||||
|
|
||||||
loop.create_task(
|
loop.create_task(
|
||||||
self.send_queue.put(
|
self.send_ui_message(
|
||||||
UpdateUsersMessage(self.name, user_id, pan_client.device_id)
|
UpdateUsersMessage(self.name, user_id, pan_client.device_id)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -255,6 +255,10 @@ class ProxyDaemon:
|
|||||||
async def send_response(self, message_id, pan_user, code, message):
|
async def send_response(self, message_id, pan_user, code, message):
|
||||||
"""Send a thread response message to the UI thread."""
|
"""Send a thread response message to the UI thread."""
|
||||||
message = DaemonResponse(message_id, pan_user, code, message)
|
message = DaemonResponse(message_id, pan_user, code, message)
|
||||||
|
await self.send_ui_message(message)
|
||||||
|
|
||||||
|
async def send_ui_message(self, message):
|
||||||
|
"""Send a thread message to the UI thread."""
|
||||||
await self.send_queue.put(message)
|
await self.send_queue.put(message)
|
||||||
|
|
||||||
async def receive_message(self, message):
|
async def receive_message(self, message):
|
||||||
@ -547,7 +551,7 @@ class ProxyDaemon:
|
|||||||
|
|
||||||
logger.info(f"Succesfully started new background sync client for " f"{user_id}")
|
logger.info(f"Succesfully started new background sync client for " f"{user_id}")
|
||||||
|
|
||||||
await self.send_queue.put(
|
await self.send_ui_message(
|
||||||
UpdateUsersMessage(self.name, user_id, pan_client.device_id)
|
UpdateUsersMessage(self.name, user_id, pan_client.device_id)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -827,7 +831,7 @@ class ProxyDaemon:
|
|||||||
client.user_id, room_id, room.display_name
|
client.user_id, room_id, room.display_name
|
||||||
)
|
)
|
||||||
|
|
||||||
await self.send_queue.put(message)
|
await self.send_ui_message(message)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = await asyncio.wait_for(
|
response = await asyncio.wait_for(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user