3 One-Click Retry & Backoff Presets
1 Batch Volume, Credit Weight & Concurrency
30,000 targets / mo2 Upstream 429/504 Rate, Backoff & Jitter Policy
12% 429/504 rateIllustrative model assuming failed 429/504 attempts also incur proxy/request charges — verify vendor official pricing.
3 Retry Protection, Latency & Best-Value Tier
Best Value: Credit Pack ($47 Once)4 Live 4-Tier Credit Budget & Headroom Matrix
| EdgeData Tier | Included Quota & SLA | Monthly Equiv. Cost | Effective $/1K Credits | Headroom / Overflow Notes |
|---|---|---|---|---|
| Free ($0/mo) | 500 credits / mo · Instant Key | Exceeds 500 cr/mo | N/A | Short by 29,494 cr/mo — use for sandbox retry testing |
| Starter Credit Pack ($47 Once)Best Value | 25,000 never-expiring credits | $56.39 / mo equiv | $1.88 / 1K cr | 2× $47 packs ($94 upfront · 20,006 never-expiring cr rollover) |
| Pro ($49/mo) | 15,000 credits / mo · 60 RPM | $77.19 / mo equiv | $2.57 / 1K cr | 15k Pro + 14,994 cr via 1× $47 Pack top-up |
| Scale ($149/mo) | 60,000 credits / mo · 200 RPM | $149.00 / mo | $4.97 / 1K eff. ($2.48 at 60k) | 30,006 cr/mo headroom · 200 RPM burst SLA |
5 Attempt 1..N Traffic Decay & Backoff Window Map
| Attempt Layer | Arriving Requests / Run | Expected HTTP 200 | Transient 429 / 504 | Backoff Window & E[Wait] | EdgeData Credits on 429/504 |
|---|---|---|---|---|---|
| Attempt 1 (Initial) | 1,000.0 req | 880.0 ok | 120.0 retryable | 0.00s – 1.50s (E[wait]=0.75s) | 0 cr (Protected) |
import asyncio
import os
import random
from typing import Any
import httpx
# EdgeData Production Retry Worker (Preset: E-Commerce Hourly Price Monitor)
# Endpoint: https://api.upp3.com/v1/amazon/products/detail
# Billing guarantee: HTTP 504/429 = 0 Credits charged (billed strictly on HTTP 200).
EDGEDATA_API_KEY = os.getenv("EDGEDATA_API_KEY", "ed_live_your_key_here")
API_ENDPOINT = "https://api.upp3.com/v1/amazon/products/detail"
CONCURRENCY = 10
MAX_RETRIES = 3
BASE_BACKOFF_SECONDS = 1.5
MAX_BACKOFF_SECONDS = 60.0
JITTER_STRATEGY = "full"
RETRYABLE_STATUS_CODES = {429, 504}
def compute_backoff_delay(attempt_index: int) -> float:
cap = min(MAX_BACKOFF_SECONDS, BASE_BACKOFF_SECONDS * (2 ** attempt_index))
if JITTER_STRATEGY == "full":
return random.uniform(0.0, cap)
if JITTER_STRATEGY == "equal":
return (cap / 2.0) + random.uniform(0.0, cap / 2.0)
return cap
async def request_with_zero_credit_retry(
client: httpx.AsyncClient,
sem: asyncio.Semaphore,
item_id: str,
) -> dict[str, Any]:
headers = {
"X-API-Key": EDGEDATA_API_KEY,
"Content-Type": "application/json",
}
payload = {
"asin": item_id,
"country": "US",
"mode": "summary",
}
async with sem:
for attempt in range(MAX_RETRIES + 1):
resp = await client.post(API_ENDPOINT, json=payload, headers=headers)
if resp.status_code == 200:
return resp.json()
if resp.status_code in RETRYABLE_STATUS_CODES and attempt < MAX_RETRIES:
# HTTP 504/429 = 0 Credits charged — safe exponential backoff retry
delay = compute_backoff_delay(attempt)
await asyncio.sleep(delay)
continue
resp.raise_for_status()
raise RuntimeError(f"Exhausted retries for item={item_id}")
async def run_batch(item_ids: list[str]) -> list[dict[str, Any]]:
sem = asyncio.Semaphore(CONCURRENCY)
limits = httpx.Limits(max_connections=CONCURRENCY + 4, max_keepalive_connections=CONCURRENCY)
async with httpx.AsyncClient(timeout=30.0, limits=limits) as client:
tasks = [request_with_zero_credit_retry(client, sem, item) for item in item_ids]
return await asyncio.gather(*tasks)
if __name__ == "__main__":
sample_items = [f"B0DEMO{idx:04d}" for idx in range(1, 21)]
output = asyncio.run(run_batch(sample_items))
print(f"Succeeded {len(output)} items (MAX_RETRIES={MAX_RETRIES}, BASE_BACKOFF_SECONDS={BASE_BACKOFF_SECONDS})")