Skip to content

feat(net): add retry with backoff to network calls#24

Merged
ntd4996 merged 1 commit into
ntd4996:mainfrom
aiexkwan:feat/network-resilience
Jun 17, 2026
Merged

feat(net): add retry with backoff to network calls#24
ntd4996 merged 1 commit into
ntd4996:mainfrom
aiexkwan:feat/network-resilience

Conversation

@aiexkwan

Copy link
Copy Markdown
Contributor

Summary

  • PetBrowser.fetch: add 10s timeout + 1 retry for transient failures (429/5xx/timeout) — previously had no timeout and silently returned []
  • CareSyncController.push: add 15s timeout + exponential backoff (30→120→300→600s) + cap at 5 consecutive failures with user-facing message — previously used fixed 300s retry with no limit
  • NativeUsageProbe: retry once on transient 5xx for both Claude and Codex probes — previously a single server hiccup would drop the provider until next poll cycle

Follows the existing PetdexAssets inline retry pattern (no new utility classes). OpenUsageClient (local 127.0.0.1 endpoint) and PetInstaller (already has retry) are intentionally unchanged.

Test plan

  • swift build — compiles cleanly
  • swift test — 194 tests, 0 failures, no regressions
  • Manual: disconnect Wi-Fi briefly while opening Browse Pets → pet library should recover after reconnecting (retry fires after 1s)
  • Manual: observe Care tab sync status after simulated server error → should show "Sync failed, will retry." with increasing delay

🤖 Generated with Claude Code

- PetBrowser.fetch: add 10s timeout + 1 retry for transient 429/5xx
- CareSyncController.push: add 15s timeout + exponential backoff (30→120→300→600s) + cap at 5 consecutive failures
- NativeUsageProbe: retry once on transient 5xx for both Claude and Codex probes

Follows the existing PetdexAssets inline retry pattern.
@ntd4996 ntd4996 merged commit 7594925 into ntd4996:main Jun 17, 2026
1 check passed
@ntd4996

ntd4996 commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Merged and shipped in v1.5.0. Solid hardening, the timeouts + backoff and the consecutive-failure cap on Care sync are a real improvement over the old fixed 300s retry, and reusing the existing inline retry pattern keeps it clean. Thanks!

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.

2 participants