Retry-Mechanismus mit Exponential Backoff für externe APIs #43

Open
opened 2026-03-30 19:55:15 +00:00 by David · 0 comments
Collaborator

Beschreibung

Alle externen API-Calls (Odoo, GitLab, Anthropic) mit einem Retry-Mechanismus (Exponential Backoff) ausstatten, um transiente Fehler (Timeouts, 429, 503) automatisch zu behandeln.

Hintergrund

Aktuell führt ein einziger Timeout oder Rate-Limit bei einem externen API-Call zu permanentem Failure des Tickets. Es gibt keinen Retry-Mechanismus. Bei kurzfristigen Netzwerkproblemen oder API-Auslastung schlagen Tickets unnötig fehl.

Akzeptanzkriterien

  • Retry-Decorator/Utility mit konfigurierbarem Exponential Backoff
  • Retryable Errors: Timeout, HTTP 429, HTTP 502/503/504, ConnectionError
  • Non-retryable Errors: HTTP 400/401/403/404 (sofortiger Failure)
  • Max Retries konfigurierbar (Default: 3)
  • Backoff-Faktor konfigurierbar (Default: 2s, 4s, 8s)
  • Jeder Retry wird geloggt mit Versuchsnummer und Wartezeit
  • Angewendet auf: Odoo JSON-RPC, GitLab API, Anthropic API, AppSignal GraphQL

Technische Hinweise

  • Neuer Utility: backend/utils/retry.py@with_retry(max_retries=3, backoff_factor=2)
  • Erweitern: backend/services/odoo_poller.py — Retry auf _fetch_tickets()
  • Erweitern: backend/services/gitlab_service.py — Retry auf alle API-Calls
  • Erweitern: backend/services/scoring_engine.py — Retry auf Anthropic-Call
  • Erweitern: backend/services/appsignal_service.py — Retry auf GraphQL-Calls
  • Alternative: tenacity Library (battle-tested, async-kompatibel)
  • Migration nötig: nein

Aufwand: M

## Beschreibung Alle externen API-Calls (Odoo, GitLab, Anthropic) mit einem Retry-Mechanismus (Exponential Backoff) ausstatten, um transiente Fehler (Timeouts, 429, 503) automatisch zu behandeln. ## Hintergrund Aktuell führt ein einziger Timeout oder Rate-Limit bei einem externen API-Call zu permanentem Failure des Tickets. Es gibt keinen Retry-Mechanismus. Bei kurzfristigen Netzwerkproblemen oder API-Auslastung schlagen Tickets unnötig fehl. ## Akzeptanzkriterien - [ ] Retry-Decorator/Utility mit konfigurierbarem Exponential Backoff - [ ] Retryable Errors: Timeout, HTTP 429, HTTP 502/503/504, ConnectionError - [ ] Non-retryable Errors: HTTP 400/401/403/404 (sofortiger Failure) - [ ] Max Retries konfigurierbar (Default: 3) - [ ] Backoff-Faktor konfigurierbar (Default: 2s, 4s, 8s) - [ ] Jeder Retry wird geloggt mit Versuchsnummer und Wartezeit - [ ] Angewendet auf: Odoo JSON-RPC, GitLab API, Anthropic API, AppSignal GraphQL ## Technische Hinweise - Neuer Utility: `backend/utils/retry.py` — `@with_retry(max_retries=3, backoff_factor=2)` - Erweitern: `backend/services/odoo_poller.py` — Retry auf `_fetch_tickets()` - Erweitern: `backend/services/gitlab_service.py` — Retry auf alle API-Calls - Erweitern: `backend/services/scoring_engine.py` — Retry auf Anthropic-Call - Erweitern: `backend/services/appsignal_service.py` — Retry auf GraphQL-Calls - Alternative: `tenacity` Library (battle-tested, async-kompatibel) - Migration nötig: nein ## Aufwand: M
Sign in to join this conversation.
No description provided.