Skip to content

feat: Appwrite client exponential backoff connection retries (#678)#686

Open
knoxiboy wants to merge 1 commit into
Shruti070107:mainfrom
knoxiboy:feat/issue-678-exponential-backoff
Open

feat: Appwrite client exponential backoff connection retries (#678)#686
knoxiboy wants to merge 1 commit into
Shruti070107:mainfrom
knoxiboy:feat/issue-678-exponential-backoff

Conversation

@knoxiboy

Copy link
Copy Markdown

Description

Resolves #678

This PR implements Appwrite client initialization reconnection logic using an exponential backoff retry loop. A floating, real-time reconnection status banner is added to notify users of retry progress and connection status.

What changed

  • Replaced the direct connection logic in CloudSync.init() with CloudSync.initWithBackoff(attempt).
  • Implemented exponential backoff delays based on Math.min(30000, Math.pow(2, attempt) * 1000).
  • Added floating reconnection banner UI helpers showReconnectionBanner and hideReconnectionBanner to display status and current retry countdowns.
  • Automatic flushing of offline-queued writes on successful reconnection.

Why

When the Appwrite service or network is offline, direct client initialization throws an uncaught error and fails silently. This prevents the application from attempting to sync once network connectivity or service is restored.

How to test

  1. Modify .env or temporarily disconnect internet access.
  2. Load the application and verify that the floating "Appwrite Connection Offline" banner is rendered at the bottom right.
  3. Verify that it retries with an increasing exponential backoff delay (2s, 4s, 8s, 16s, up to 30s).
  4. Restore connectivity and verify that the banner automatically hides once a connection is successfully established.

Checklist

  • Tested changes locally
  • No lint/syntax errors introduced
  • Matches all issue criteria

Files Affected

  • src/cloud-sync.js

@knoxiboy knoxiboy force-pushed the feat/issue-678-exponential-backoff branch from 9156184 to 54ec7b3 Compare June 13, 2026 11:18
@knoxiboy

Copy link
Copy Markdown
Author

@Shruti070107 Please review this pr and merge it

1 similar comment
@knoxiboy

Copy link
Copy Markdown
Author

@Shruti070107 Please review this pr and merge it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Exponential Backoff Reconnection for Appwrite Database Connection

1 participant