Skip to content

feat: Retry data sources after unexpected HTTP errors instead of stopping - #406

Draft
beekld wants to merge 5 commits into
mainfrom
bklimt/SDK-2803/retry-backoff
Draft

beekld wants to merge 5 commits into
mainfrom
bklimt/SDK-2803/retry-backoff

Conversation

@beekld

@beekld beekld commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Android equivalent of ios-client-sdk#533 (SDK-2802). The streaming and polling data sources stopped permanently on 401, 403, and most other 4xx statuses, and a 401 shut down the whole client. They now retry those failures with a longer backoff than other errors: 5 minutes, doubling to 1 hour. The client stays uninitialized and keeps trying.

Implementation notes:

Notes for reviewers:

  • In FDv2 the orchestrator holds the long backoff, so fallback stays immediate: a synchronizer reports TERMINAL_ERROR on a 401, FDv2DataSource moves to the next one at once, and the failed slot returns after a backoff instead of permanently. If every slot is backing off, the data source waits rather than reporting OFF.
  • Recovery to a higher-priority synchronizer waits until that synchronizer's backoff has ended.
  • The SDK's data sources no longer call DataSourceUpdateSink.shutDown(). It stays in the interface for custom data sources.
  • Polling failures now set isRetryable() from the status code rather than always true.
  • Unlike iOS, setOnline() starts a fresh backoff, because Android builds a new data source on every state change.

Contract tests declare retry-conformance-fdv1-streaming and retry-conformance-fdv1-polling, so the harness skips its legacy "do not retry" client tests.

Testing

  • RetryStateTest covers the backoff algorithm; SourceManagerTest covers slot backoff.
  • The data source and synchronizer tests that asserted a permanent stop now assert a retry.

This branch has not been deployed

No deployments
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.

1 participant