Skip to content

fix: retry OBS downloads on 404 and handle media failures gracefully - #73

Merged
highesttt merged 1 commit into
beeper:mainfrom
clins1994:fix/reliable-photo-bundle
Apr 5, 2026
Merged

highesttt merged 1 commit into
beeper:mainfrom
clins1994:fix/reliable-photo-bundle

Conversation

@clins1994

@clins1994 clins1994 commented Apr 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Retry OBS media downloads on 404 responses (LINE returns 404 transiently for recently uploaded media)
  • Gracefully handle media download failures instead of breaking the entire message flow

Please see: https://github.com/clins1994/matrix-line-messenger/pull/2 for more information

Closes #71

Problem (before)

flowchart TD
    A[Bundle of photos sent on LINE] --> B[Bridge receives multiple messages]
    B --> C[Download media from OBS for each]
    
    C --> D{OBS response?}
    D -->|200 OK| E[Media bridged successfully]
    D -->|202 Processing| F[Retry up to 5x with 2s delay]
    D -->|404 Not Found| G[Immediate hard error]
    
    G --> H[fmt.Errorf returned]
    H --> I[Entire message dropped]
    I --> J[User never sees the photo on Beeper]
    
    F -->|Eventually 200| E
    F -->|Still 202| H
    
    style G fill:#e76f51,color:#fff
    style I fill:#e76f51,color:#fff
    style J fill:#e76f51,color:#fff
Loading

Root cause: LINE's OBS returns transient 404s for recently uploaded media (race condition between upload confirmation and storage propagation). The bridge treated 404 as a permanent failure. When any single download in a bundle failed, the entire message was dropped with no trace on Beeper.

Solution (after)

flowchart TD
    A[Bundle of photos sent on LINE] --> B[Bridge receives multiple messages]
    B --> C[Download media from OBS for each]
    
    C --> D{OBS response?}
    D -->|200 OK| E[Media bridged successfully]
    D -->|202 Processing| F[Retry up to 5x with 2s delay]
    D -->|404 Not Found| F
    
    F -->|Eventually 200| E
    F -->|Still failing| G[Send placeholder message]
    G --> H["[Image unavailable — LINE media expired before it could be bridged]"]
    
    H --> I[User sees the placeholder on Beeper]
    E --> J[User sees the photo on Beeper]
    
    style E fill:#2d6a4f,color:#fff
    style J fill:#2d6a4f,color:#fff
    style I fill:#e9c46a,color:#000
Loading

Two improvements:

  1. 404 retry — transient 404s are retried alongside 202s (up to 5x with 2s delay), giving OBS time to propagate
  2. Graceful degradation — if download still fails after retries, a placeholder notice is sent instead of silently dropping the message

Test plan

  • Send a bundle of photos in a LINE chat and verify all are received on the bridge side
  • Verify single image/video/file downloads still work normally

🤖 Generated with Claude Code

@highesttt
highesttt merged commit 16ef507 into beeper:main Apr 5, 2026
2 checks passed
@clins1994
clins1994 deleted the fix/reliable-photo-bundle branch April 20, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

bug: 🐛 bundle of photos don't get sent reliably

2 participants