浏览代码

Log when sending commands over MQTT

Tulir Asokan 2 年之前
父节点
当前提交
ee8f82fc3c
共有 2 个文件被更改,包括 5 次插入1 次删除
  1. 3 1
      mauigpapi/mqtt/conn.py
  2. 2 0
      mautrix_instagram/portal.py

+ 3 - 1
mauigpapi/mqtt/conn.py

@@ -734,6 +734,7 @@ class AndroidMQTT:
         client_context: str | None = None,
         **kwargs: Any,
     ) -> CommandResponse | None:
+        self.log.debug(f"Preparing to send {action} to {thread_id} with {client_context}")
         client_context = client_context or self.state.gen_client_context()
         req = {
             "thread_id": thread_id,
@@ -747,9 +748,10 @@ class AndroidMQTT:
         async with self._message_response_waiter_lock:
             lock_wait_dur = time.monotonic() - lock_start
             if lock_wait_dur > 1:
-                self.log.debug(f"Waited {lock_wait_dur:.3f} seconds to send {client_context}")
+                self.log.warning(f"Waited {lock_wait_dur:.3f} seconds to send {client_context}")
             fut = self._message_response_waiter = asyncio.Future()
             self._message_response_waiter_id = client_context
+            self.log.debug(f"Publishing {action} to {thread_id} with {client_context}")
             await self.publish(RealtimeTopic.SEND_MESSAGE, req)
             self.log.trace(
                 f"Request published to {RealtimeTopic.SEND_MESSAGE}, "

+ 2 - 0
mautrix_instagram/portal.py

@@ -505,6 +505,8 @@ class Portal(DBPortal, BasePortal):
         )
 
         if message.msgtype == MessageType.NOTICE and not self.config["bridge.bridge_notices"]:
+            self.log.debug(f"Dropping m.notice event {event_id}")
+            # TODO send checkpoint
             return
 
         if message.msgtype in (MessageType.EMOTE, MessageType.TEXT, MessageType.NOTICE):