Add retry logic for pattern fetch API calls #68

Closed
opened 2026-05-11 07:47:50 +00:00 by rodin · 0 comments
Owner

Problem

Pattern fetching via Gitea contents API intermittently returns HTTP 500:

time=2026-05-11T07:45:46.943Z level=WARN msg="could not fetch patterns" path=. repo=rodin/ddd-patterns error="list contents \".\": list contents .: HTTP 500: {\"message\":\"\",\"url\":\"https://gitea.weiker.me/api/swagger\"}"

This happens even for public repos like rodin/ddd-patterns. Manual testing shows 5/5 successes - the 500s appear to be transient, possibly load-related when multiple review jobs hit the API simultaneously.

Impact

Reviewers run without pattern context when fetch fails, reducing review quality.

Solution

Add retry with exponential backoff (2-3 attempts, 1s/2s delays) to fetchPatterns() in cmd/review-bot/main.go.

Acceptance Criteria

  • GetAllFilesInPath retries on 5xx errors (max 3 attempts)
  • Exponential backoff between retries
  • Log retries at WARN level
  • Fail gracefully after all retries exhausted (current behavior)
## Problem Pattern fetching via Gitea contents API intermittently returns HTTP 500: ``` time=2026-05-11T07:45:46.943Z level=WARN msg="could not fetch patterns" path=. repo=rodin/ddd-patterns error="list contents \".\": list contents .: HTTP 500: {\"message\":\"\",\"url\":\"https://gitea.weiker.me/api/swagger\"}" ``` This happens even for public repos like `rodin/ddd-patterns`. Manual testing shows 5/5 successes - the 500s appear to be transient, possibly load-related when multiple review jobs hit the API simultaneously. ## Impact Reviewers run without pattern context when fetch fails, reducing review quality. ## Solution Add retry with exponential backoff (2-3 attempts, 1s/2s delays) to `fetchPatterns()` in `cmd/review-bot/main.go`. ## Acceptance Criteria - [ ] `GetAllFilesInPath` retries on 5xx errors (max 3 attempts) - [ ] Exponential backoff between retries - [ ] Log retries at WARN level - [ ] Fail gracefully after all retries exhausted (current behavior)
rodin added the wip label 2026-05-11 07:53:42 +00:00
rodin removed the wip label 2026-05-11 08:01:57 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rodin/review-bot#68