[Bug] Telegram album debounce exceeds the maximum wait

Open Beginner friendly
#11,123 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@123XieC is already working on this.

Since Nov 14, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Start in TelegramPlatformAdapter.handle_media_group_message, where the collection job is scheduled from telegram_media_group_timeout and telegram_media_group_max_wait. Check how the replacement job's run_date is computed when a new update arrives for the same album. Done when a late update is scheduled no later than the original deadline (immediately if already past it), with a test that reads the scheduled run_date after a synthetic update at 9 seconds.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
46.4k
Forks
3.4k
Avg merge
1d 10h
Merged PRs (30d)
111

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AstrBotDevs/AstrBot

All issues in AstrBotDevs/AstrBot

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.