Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Retry Policy Refactor to Reduce Unnecessary API Calls

Описание и применение

Переписали логику повторных запросов к внешнему API, ограничив их только ошибками сервера и соблюдая заголовок Retry‑After, что сократило время обработки батчей до 90 с и остановило рост очереди.

Задача

A retry helper was blindly retrying failed API calls, causing unnecessary quota consumption and backlog growth.

Результат

Batch processing time reduced from ~4 min to ~90 s, quota consumption stabilized, and backlog growth halted.

Рабочий процесс

  • 1. Identify retry helper logic. 2. Replace loop with predicate that checks status code and headers. 3. Retry only on 429 or 5xx responses. 4. Honor Retry‑After header. 5. Cap attempts and return original error on first non‑retryable response. 6. Deploy change and monitor batch latency and quota usage.

Доказательства

The old helper was a loop and a sleep: up to four tries, a flat two-second wait, no branching on the response.

Источник

The replacement is a small predicate that reads the status code and the headers before deciding anything.

Источник

The batch settled back to about ninety seconds and the quota survived into the evening.

Источник

  • Дата записи: 2026-10-21T08:56:02.518Z