fix(restart): deliver completion after channel reconnects (#4931)

This commit is contained in:
chengyongru
2026-07-15 01:08:39 +08:00
committed by GitHub
parent 37165b0db0
commit 88c38e9b38
19 changed files with 284 additions and 55 deletions
+6 -4
View File
@@ -710,10 +710,11 @@ class DingTalkChannel(BaseChannel):
"""Send a message through DingTalk."""
token = await self._get_access_token()
if not token:
return
raise RuntimeError("DingTalk access token unavailable")
if msg.content and msg.content.strip():
await self._send_markdown_text(token, msg.chat_id, msg.content.strip())
if not await self._send_markdown_text(token, msg.chat_id, msg.content.strip()):
raise RuntimeError("DingTalk text message was not delivered")
for media_ref in msg.media or []:
ok = await self._send_media_ref(token, msg.chat_id, media_ref)
@@ -722,11 +723,12 @@ class DingTalkChannel(BaseChannel):
self.logger.error("media send failed for {}", media_ref)
# Send visible fallback so failures are observable by the user.
filename = self._guess_filename(media_ref, self._guess_upload_type(media_ref))
await self._send_markdown_text(
if not await self._send_markdown_text(
token,
msg.chat_id,
f"[Attachment send failed: {filename}]",
)
):
raise RuntimeError("DingTalk attachment fallback was not delivered")
async def _on_message(
self,