fix(weixin): add rate-limit circuit breaker

This commit is contained in:
Hariharan Ayappane
2026-06-07 22:10:17 -07:00
committed by Teknium
parent 2e62862784
commit b8469a81e3
3 changed files with 174 additions and 6 deletions
+10 -6
View File
@@ -588,6 +588,16 @@ async def _send_to_platform(platform, pconfig, chat_id, message, thread_id=None,
(preserves code-block boundaries, adds part indicators).
"""
from gateway.config import Platform
media_files = media_files or []
# Weixin handles text/media delivery inside its native helper and does not
# need the optional platform adapter imports below. Keep this branch early
# so a Weixin send is not blocked by unrelated optional dependencies (for
# example lark-oapi's heavy Feishu import path).
if platform == Platform.WEIXIN:
return await _send_weixin(pconfig, chat_id, message, media_files=media_files)
from gateway.platforms.base import BasePlatformAdapter, utf16_len
from gateway.platforms.slack import SlackAdapter
@@ -605,8 +615,6 @@ async def _send_to_platform(platform, pconfig, chat_id, message, thread_id=None,
except ImportError:
_feishu_available = False
media_files = media_files or []
if platform == Platform.SLACK and message:
try:
slack_adapter = SlackAdapter.__new__(SlackAdapter)
@@ -663,10 +671,6 @@ async def _send_to_platform(platform, pconfig, chat_id, message, thread_id=None,
last_result = result
return last_result
# --- Weixin: use the native one-shot adapter helper for text + media ---
if platform == Platform.WEIXIN:
return await _send_weixin(pconfig, chat_id, message, media_files=media_files)
# --- Discord: chunked delivery via the registry's standalone_sender_fn.
# The plugin's ``_standalone_send`` (registered in
# plugins/platforms/discord/adapter.py) handles forum channels, threads,