fix(images): eliminate race condition when pressing v on downloading photo #26

Merged
killingdruid merged 1 commits from refactor into main 2026-03-02 23:19:14 +00:00
Owner

Previously, handle_view_image called td_client.download_file() synchronously
while process_pending_chat_init already had a background synchronous=true
download in flight for the same file. TDLib returned is_downloading_completed=false
causing the view to fail on first press.

Fix: replace the blocking download in NotDownloaded/Downloading branches with
a pending_image_open intent flag. The main loop opens the modal automatically
when the background download result arrives via photo_download_rx. If no
background channel exists, a new one is started via direct tdlib_rs call.

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Previously, handle_view_image called td_client.download_file() synchronously while process_pending_chat_init already had a background synchronous=true download in flight for the same file. TDLib returned is_downloading_completed=false causing the view to fail on first press. Fix: replace the blocking download in NotDownloaded/Downloading branches with a pending_image_open intent flag. The main loop opens the modal automatically when the background download result arrives via photo_download_rx. If no background channel exists, a new one is started via direct tdlib_rs call. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
killingdruid added 1 commit 2026-03-02 23:18:06 +00:00
fix(images): eliminate race condition when pressing v on downloading photo
Some checks failed
ci/woodpecker/pr/check Pipeline failed
90776448ce
Previously, handle_view_image called td_client.download_file() synchronously
while process_pending_chat_init already had a background synchronous=true
download in flight for the same file. TDLib returned is_downloading_completed=false
causing the view to fail on first press.

Fix: replace the blocking download in NotDownloaded/Downloading branches with
a pending_image_open intent flag. The main loop opens the modal automatically
when the background download result arrives via photo_download_rx. If no
background channel exists, a new one is started via direct tdlib_rs call.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
killingdruid merged commit d3565c9ff9 into main 2026-03-02 23:19:14 +00:00
killingdruid deleted branch refactor 2026-03-02 23:19:14 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: killingdruid/telegram-tui#26