Skip to content

Conversation

@fru-9D
Copy link
Contributor

@fru-9D fru-9D commented Oct 2, 2025

Overview

This PR introduces a new configuration option skip_media_during_sync that allows users to skip media downloads during initial history sync for significantly faster completion times.

Problem

History sync can be slow and resource-intensive, especially for users with large chat histories containing many media files. The media download process during sync can significantly delay the completion of initial sync.

Solution

  • New Configuration: Added skip_media_during_sync boolean option in the history_sync section
  • Context-Aware Media Handling: Modified media processing to skip downloads when the option is enabled during backfill
  • Manual Media Recovery: Users can still request historical media manually through the existing media retry system

Key Changes

Configuration (config.go, example-config.yaml)

  • Added SkipMediaDuringSync bool field to HistorySync config struct
  • Updated config upgrade function to handle the new field
  • Added documentation in example config

Media Processing (wa-media.go)

  • Modified reuploadWhatsAppAttachment() to check for is_backfill and skip_media context values
  • When both conditions are true, the function returns early without downloading/uploading media

Backfill Context (backfill.go)

  • Enhanced convertHistorySyncMessage() to set backfill context with is_backfill: true and skip_media: [config value]
  • Updated ToMatrix() call to include the new isBackfill parameter

Benefits

  1. Faster Sync Completion: Significantly reduces initial sync time by skipping media downloads
  2. Reduced Resource Usage: Lower bandwidth and storage requirements during sync
  3. Better User Experience: Users can start using the bridge sooner
  4. Backward Compatible: Existing functionality remains unchanged when the option is disabled

Configuration Example

history_sync:
  skip_media_during_sync: true  # Skip media during initial sync for faster completion

Migration

No database migration required. The new configuration option defaults to false to maintain existing behavior for existing installations.

@tulir
Copy link
Member

tulir commented Oct 2, 2025

This doesn't look very useful as the media will be lost forever. Async uploads and direct media already exist for making media faster

@tulir tulir closed this Oct 2, 2025
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.

3 participants