Skip to content

**Retry failed sessions during synchronization** #1

Description

@Harshit4847

Description

The current session synchronization flow only fetches sessions with syncStatus = 'PENDING'.

This causes failed sessions to be permanently excluded from future synchronization attempts.

Current behavior

PENDING → Sync attempt → Server/Network error → FAILED
                                      ↓
                         Excluded from future syncs

The DAO query currently uses:

WHERE syncStatus = 'PENDING'

So even if WorkManager returns Result.retry(), the next synchronization attempt will not pick up sessions that are already marked as FAILED.

Expected behavior

Failed sessions should remain eligible for future synchronization attempts.

A minimal solution would be:

WHERE syncStatus IN ('PENDING', 'FAILED')

A more robust retry mechanism could also track:

  • failureCount
  • nextRetryAt
  • lastError
  • lastAttemptAt

This would allow the synchronization system to implement controlled retries, such as exponential backoff, instead of retrying failed sessions indefinitely or immediately.

Impact

Currently, a temporary server or network failure can cause a session to become permanently unsynchronized unless it is manually reset to PENDING.

This can result in permanent data loss from the backend.

Suggested solution

Implement retryable synchronization for failed sessions, preferably with retry metadata and backoff handling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions