fix(telegram): apply media read_timeout to all upload send paths, not just video
send_video got the 60s read_timeout but send_voice/send_audio/send_photo/ send_document/send_media_group/send_animation upload through the same PTB request path and hit the same server-side processing wait before the response arrives. Same class, all sites: they all pass _MEDIA_SEND_READ_TIMEOUT now. Also drops an unused test helper.
This commit is contained in:
parent
0a2859cf9a
commit
524ab53994
|
|
@ -6821,6 +6821,7 @@ class TelegramAdapter(BasePlatformAdapter):
|
||||||
"parse_mode": _cap_parse_mode,
|
"parse_mode": _cap_parse_mode,
|
||||||
"reply_to_message_id": reply_to_id,
|
"reply_to_message_id": reply_to_id,
|
||||||
"duration": _duration_secs,
|
"duration": _duration_secs,
|
||||||
|
"read_timeout": _MEDIA_SEND_READ_TIMEOUT,
|
||||||
**voice_thread_kwargs,
|
**voice_thread_kwargs,
|
||||||
**self._notification_kwargs(metadata),
|
**self._notification_kwargs(metadata),
|
||||||
},
|
},
|
||||||
|
|
@ -6870,6 +6871,7 @@ class TelegramAdapter(BasePlatformAdapter):
|
||||||
"caption": caption[:1024] if caption else None,
|
"caption": caption[:1024] if caption else None,
|
||||||
"reply_to_message_id": reply_to_id,
|
"reply_to_message_id": reply_to_id,
|
||||||
"duration": _duration_secs,
|
"duration": _duration_secs,
|
||||||
|
"read_timeout": _MEDIA_SEND_READ_TIMEOUT,
|
||||||
**audio_thread_kwargs,
|
**audio_thread_kwargs,
|
||||||
**self._notification_kwargs(metadata),
|
**self._notification_kwargs(metadata),
|
||||||
},
|
},
|
||||||
|
|
@ -7008,6 +7010,7 @@ class TelegramAdapter(BasePlatformAdapter):
|
||||||
"chat_id": normalize_telegram_chat_id(chat_id),
|
"chat_id": normalize_telegram_chat_id(chat_id),
|
||||||
"media": media,
|
"media": media,
|
||||||
"reply_to_message_id": reply_to_id,
|
"reply_to_message_id": reply_to_id,
|
||||||
|
"read_timeout": _MEDIA_SEND_READ_TIMEOUT,
|
||||||
**thread_kwargs,
|
**thread_kwargs,
|
||||||
**self._notification_kwargs(metadata),
|
**self._notification_kwargs(metadata),
|
||||||
},
|
},
|
||||||
|
|
@ -7067,6 +7070,7 @@ class TelegramAdapter(BasePlatformAdapter):
|
||||||
"photo": image_file,
|
"photo": image_file,
|
||||||
"caption": caption[:1024] if caption else None,
|
"caption": caption[:1024] if caption else None,
|
||||||
"reply_to_message_id": reply_to_id,
|
"reply_to_message_id": reply_to_id,
|
||||||
|
"read_timeout": _MEDIA_SEND_READ_TIMEOUT,
|
||||||
**thread_kwargs,
|
**thread_kwargs,
|
||||||
**self._notification_kwargs(metadata),
|
**self._notification_kwargs(metadata),
|
||||||
},
|
},
|
||||||
|
|
@ -7164,6 +7168,7 @@ class TelegramAdapter(BasePlatformAdapter):
|
||||||
"filename": display_name,
|
"filename": display_name,
|
||||||
"caption": caption[:1024] if caption else None,
|
"caption": caption[:1024] if caption else None,
|
||||||
"reply_to_message_id": reply_to_id,
|
"reply_to_message_id": reply_to_id,
|
||||||
|
"read_timeout": _MEDIA_SEND_READ_TIMEOUT,
|
||||||
**thread_kwargs,
|
**thread_kwargs,
|
||||||
**self._notification_kwargs(metadata),
|
**self._notification_kwargs(metadata),
|
||||||
},
|
},
|
||||||
|
|
@ -7359,6 +7364,7 @@ class TelegramAdapter(BasePlatformAdapter):
|
||||||
"animation": animation_url,
|
"animation": animation_url,
|
||||||
"caption": caption[:1024] if caption else None,
|
"caption": caption[:1024] if caption else None,
|
||||||
"reply_to_message_id": reply_to_id,
|
"reply_to_message_id": reply_to_id,
|
||||||
|
"read_timeout": _MEDIA_SEND_READ_TIMEOUT,
|
||||||
**animation_thread_kwargs,
|
**animation_thread_kwargs,
|
||||||
**self._notification_kwargs(metadata),
|
**self._notification_kwargs(metadata),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -192,10 +192,6 @@ class TestManagedMediaUploader:
|
||||||
BASE_URL = f"{GATEWAY}/api/bfl"
|
BASE_URL = f"{GATEWAY}/api/bfl"
|
||||||
UPLOAD_PATH = "/api/uploads/bfl"
|
UPLOAD_PATH = "/api/uploads/bfl"
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _builder(vendor):
|
|
||||||
return f"https://{vendor}-gateway.example.com"
|
|
||||||
|
|
||||||
def _uploader(self, **kwargs):
|
def _uploader(self, **kwargs):
|
||||||
return managed_tool_gateway.build_managed_media_uploader(
|
return managed_tool_gateway.build_managed_media_uploader(
|
||||||
kwargs.pop("server_url", self.BASE_URL),
|
kwargs.pop("server_url", self.BASE_URL),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue