[Bug] Telegram album debounce exceeds the maximum wait

未关闭 适合新手
#11,123 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@123XieC 已经在做这个了。

开始于 2026年11月14日。

  • #11124 来自 @123XieC —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend

调研方向

从 TelegramPlatformAdapter.handle_media_group_message 开始,这里根据 telegram_media_group_timeout 和 telegram_media_group_max_wait 调度收集任务。检查同一相册有新更新到达时,替换任务的 run_date 是如何计算的。完成标准是:迟到的更新被调度到不晚于原始截止时间(若已超过截止时间则立即调度),并附带一个测试,在第 9 秒的合成更新之后读取已调度的 run_date。

由索引模型根据 Issue 内容生成。

描述

Bug description

Telegram media-group collection can schedule processing after the configured maximum wait. An album whose last part arrives shortly before the deadline is given a new full debounce delay.

Reproduction
  1. Use telegram_media_group_timeout = 2.5 and telegram_media_group_max_wait = 10.0, the defaults.
  2. Deliver an album update at elapsed time zero to TelegramPlatformAdapter.handle_media_group_message. This schedules its collection job for 2.5 seconds.
  3. On a busy event loop where that job has not run, deliver another update for the same album at elapsed time 9 seconds. Continuous updates in smaller gaps can also keep rescheduling the job until this point.
  4. Read the scheduled run_date of the replacement job.
Actual result

The new run time is 11.5 seconds after the first update, beyond the configured 10-second cap.

Expected result

The new run time is the earlier of the debounce time and the original deadline. An album received after its deadline should be scheduled for immediate processing.

Environment

AstrBot source at 23db1ad08064a8330a09077138ce8ecc05362219 on macOS, Python 3.12. Reproduced with synthetic Telegram updates and the actual adapter handler. No Telegram bot token or network call is needed.

主要语言
Python
星标
46.4k
派生
3.4k
平均合并
1 天 10 小时
30 天内合并 PR
111

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AstrBotDevs/AstrBot 的其他 Issue

查看 AstrBotDevs/AstrBot 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。