Advanced·Scenario·2 min read

A third-party API starts timing out. What do I do?

Practice this question

Short explanation:

A third-party timeout means your service did not receive an answer within its waiting budget. It does not prove that the remote operation was never performed. Timeouts need bounded waiting, controlled concurrency and a strategy for uncertain results, especially for actions with side effects.

Key points:

  • Set deadlines and cap concurrent requests so the app does not pile up work.

  • Retry temporary failures only when safe, with backoff and jitter.

  • Use a circuit breaker, delayed jobs or a clear degraded response; reconcile uncertain side effects.

  • Respect Retry-After and the provider's idempotency or status-query mechanisms when available.

  • Stop repeated calls temporarily when failure is persistent, and expose pending or degraded status to users.

Interview point:

  • Distinguish retrying a read from retrying an uncertain payment or notification send.
Adapted from 08_PERFORMANCE_SECURITY.md · “8. A third-party API starts timing out. What do I do?”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.