Skip to content

feat: Automatic retry with exponential backoff #52

@Snider

Description

@Snider

Summary

Automatic retry for transient failures with configurable backoff.

Use Case

Network hiccups, temporary 5xx errors, rate limit hits - should retry automatically.

Retry Strategy

Attempt 1: immediate
Attempt 2: wait 1s
Attempt 3: wait 2s
Attempt 4: wait 4s
Attempt 5: wait 8s (max)

Commands

# Default retry (3 attempts)
borg collect website https://example.com

# More attempts
borg collect website https://example.com --retries 5

# Custom backoff
borg collect website https://example.com --retry-backoff 2s --retry-max 30s

# No retry
borg collect website https://example.com --no-retry

Retryable Errors

Error Retry?
429 Too Many Requests Yes (with Retry-After)
500 Internal Server Error Yes
502 Bad Gateway Yes
503 Service Unavailable Yes
504 Gateway Timeout Yes
Connection timeout Yes
Connection reset Yes
DNS failure Yes (1 retry)
404 Not Found No
403 Forbidden No

Configuration

# .borg-retry.yaml
retries: 5
backoff:
  initial: 1s
  multiplier: 2
  max: 60s
  jitter: 0.1  # ±10% randomization

# Per-error overrides
errors:
  429:
    use_retry_after: true
    max_wait: 300s
  dns:
    retries: 1

Options

Flag Description
--retries N Max retry attempts
--retry-backoff Initial backoff duration
--retry-max Maximum backoff duration
--retry-jitter Randomization factor
--no-retry Disable retries

Acceptance Criteria

  • Exponential backoff implementation
  • Retry-After header respect
  • Jitter to prevent thundering herd
  • Per-error-type configuration
  • Max total retry time limit

Metadata

Metadata

Assignees

No one assigned

    Labels

    julesFor Jules AI to work on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions