[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-trigger-dev-staff-engineering-skills-retry-storms":3,"mdc-6cjjb8-key":37,"related-org-trigger-dev-staff-engineering-skills-retry-storms":4346,"related-repo-trigger-dev-staff-engineering-skills-retry-storms":4512},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":12,"stars":26,"repoUrl":27,"updatedAt":28,"license":29,"forks":30,"topics":31,"repo":32,"sourceUrl":35,"mdContent":36},"staff-engineering-skills-retry-storms","prevent retry storms in distributed services","Prevent retry logic from amplifying failures into cascading outages. Use when adding retry logic to network calls, configuring HTTP clients, building service-to-service communication, handling timeouts, or working with multi-layer architectures where retries exist at multiple levels. Activates on patterns like retry loops without backoff or jitter, retrying all HTTP errors including 4xx, retry logic at multiple layers of a call chain, retries without circuit breakers, or timeouts that don't account for remaining deadline budget.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},"trigger-dev","Trigger.dev","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Ftrigger-dev.jpg","triggerdotdev",[13,17,20,23],{"name":14,"slug":15,"type":16},"Performance","performance","tag",{"name":18,"slug":19,"type":16},"Architecture","architecture",{"name":21,"slug":22,"type":16},"Engineering","engineering",{"name":24,"slug":25,"type":16},"API Development","api-development",3,"https:\u002F\u002Fgithub.com\u002Ftriggerdotdev\u002Fstaff-engineering-skills","2026-06-17T08:40:50.07711",null,1,[],{"repoUrl":27,"stars":26,"forks":30,"topics":33,"description":34},[],"Skills that give AI   coding agents staff-engineer instincts: recognizing and avoiding production failure modes like cardinality, idempotency, and race conditions.","https:\u002F\u002Fgithub.com\u002Ftriggerdotdev\u002Fstaff-engineering-skills\u002Ftree\u002FHEAD\u002Fskills\u002Fstaff-engineering-skills-retry-storms","---\nname: staff-engineering-skills-retry-storms\ndescription: Prevent retry logic from amplifying failures into cascading outages. Use when adding retry logic to network calls, configuring HTTP clients, building service-to-service communication, handling timeouts, or working with multi-layer architectures where retries exist at multiple levels. Activates on patterns like retry loops without backoff or jitter, retrying all HTTP errors including 4xx, retry logic at multiple layers of a call chain, retries without circuit breakers, or timeouts that don't account for remaining deadline budget.\n---\n\n# Retry Storms Trap\n\nThe service is slow. Your retries made it slower. Before adding retry logic, ask: **what happens when every client retries at the same time against an already-struggling service?**\n\n## The Feedback Loop\n\nRetry storms are a positive feedback loop: worse performance draws more retries, which worsens performance, which draws more retries. The only stable states are \"working fine\" and \"completely dead.\"\n\n```\nService slow → clients time out → retry → 2x load → slower\n  → more timeouts → more retries → 4x load → collapse\n```\n\nThe system can't recover under load because retries prevent the load from decreasing.\n\n## The Layer Multiplication Problem\n\nThree layers of 3 retries = 27 backend calls for one user request.\n\n```\nUser request\n  → Gateway 3x → Service A 3x → Service B 3x → Database\n        = 3 × 3 × 3 = 27 database queries\n```\n\nEach layer multiplies independently. An agent adding \"just 3 retries\" to Service A doesn't know Service B already has 3. Nobody calculated the total.\n\n**Before adding retries, count the total retry multiplication across the full call chain.**\n\n## Detection: When You're Building a Retry Storm\n\n**Stop and fix if you see:**\n\n1. **Retry logic at multiple layers** -- calculate worst-case total. More than ~10 for one user request is too many. Retry at ONE layer, ideally the outermost.\n\n2. **Retrying all errors, including 4xx** -- 400\u002F401\u002F409 will never succeed on retry. Only retry 5xx, 429, 408, and network errors.\n\n3. **Fixed-interval retries or no backoff** -- `sleep(1000)` makes all clients retry the same second. Use exponential backoff with jitter.\n\n4. **Retries without a circuit breaker** -- retries into a dead service generate load that prevents recovery. A breaker stops sending after repeated failures, giving the service time to recover.\n\n5. **Timeout × retry count exceeds the user's patience** -- 30s × 3 = 120s worst case; is the user still waiting? Each retry should use the remaining deadline, not a fresh timeout.\n\n6. **Retry logic in both the HTTP client library and application code** -- Axios, AWS SDK, gRPC retry by default. App-level retries on top multiply silently. Check your client's default retry config.\n\n## Patterns\n\n### Only retry retriable errors\n\n```typescript\nfunction isRetriable(error: unknown): boolean {\n  if (error instanceof HttpError) {\n    return error.status >= 500 || error.status === 429 || error.status === 408;\n  }\n  \u002F\u002F Network errors (connection refused, DNS failure, TCP reset)\n  if (error instanceof TypeError && error.message.includes(\"fetch\")) return true;\n  return false;\n}\n```\n\n| Status | Retry? | Why |\n|--------|--------|-----|\n| 400 \u002F 422 | No | Input\u002Fvalidation wrong, won't change |\n| 401 \u002F 403 | No | Credentials wrong \u002F permission denied |\n| 404 | No | Resource doesn't exist |\n| 409 Conflict | No | Operation already happened or state conflict |\n| 429 Too Many Requests | Yes | Rate limited, back off and retry |\n| 408 Request Timeout | Yes | Server timed out, may work on retry |\n| 500+ Server Error | Yes | Transient server issue |\n| Network error | Yes | Connection failed, may work on retry |\n\n### Exponential backoff with full jitter\n\n```typescript\nasync function retryWithBackoff\u003CT>(\n  fn: () => Promise\u003CT>,\n  options: { maxRetries?: number; baseDelayMs?: number } = {},\n): Promise\u003CT> {\n  const { maxRetries = 3, baseDelayMs = 200 } = options;\n\n  for (let attempt = 0; attempt \u003C= maxRetries; attempt++) {\n    try {\n      return await fn();\n    } catch (error) {\n      if (attempt === maxRetries || !isRetriable(error)) throw error;\n      \u002F\u002F Full jitter: random point in the exponential window\n      const delay = Math.random() * (baseDelayMs * 2 ** attempt);\n      await new Promise((r) => setTimeout(r, delay));\n    }\n  }\n  throw new Error(\"unreachable\");\n}\n```\n\nFull jitter (`random * maxDelay`) spreads retries across the entire backoff window. Without jitter, all clients that failed together retry together -- a thundering herd of retries.\n\n### Circuit breaker (stop retrying into a dead service)\n\n```typescript\nclass CircuitBreaker {\n  private failures = 0;\n  private lastFailure = 0;\n  private state: \"closed\" | \"open\" | \"half-open\" = \"closed\";\n\n  constructor(private threshold = 5, private resetMs = 30_000) {}\n\n  async call\u003CT>(fn: () => Promise\u003CT>): Promise\u003CT> {\n    if (this.state === \"open\") {\n      if (Date.now() - this.lastFailure > this.resetMs) this.state = \"half-open\"; \u002F\u002F allow one test\n      else throw new CircuitBreakerOpenError(); \u002F\u002F fail fast\n    }\n    try {\n      const result = await fn();\n      this.failures = 0;\n      this.state = \"closed\";\n      return result;\n    } catch (err) {\n      this.failures++;\n      this.lastFailure = Date.now();\n      if (this.failures >= this.threshold) this.state = \"open\";\n      throw err;\n    }\n  }\n}\n```\n\nWhen open, requests fail immediately instead of waiting for a timeout, giving the downstream service time to recover. After `resetMs`, one test request is allowed through; if it succeeds the circuit closes and traffic resumes.\n\n### Retry budget (system-level protection)\n\nLimit retries as a percentage of total traffic, not per-request.\n\n```typescript\nclass RetryBudget {\n  private requests = 0;\n  private retries = 0;\n\n  constructor(private maxRetryRatio = 0.1, private minRetriesPerWindow = 10) {\n    setInterval(() => { this.requests = 0; this.retries = 0; }, 1000); \u002F\u002F sliding window\n  }\n\n  recordRequest() { this.requests++; }\n  recordRetry() { this.retries++; }\n\n  shouldRetry(): boolean {\n    if (this.retries \u003C this.minRetriesPerWindow) return true; \u002F\u002F always allow some\n    return this.retries \u002F Math.max(this.requests, 1) \u003C this.maxRetryRatio;\n  }\n}\n```\n\nWith a 10% budget at 1,000 req\u002Fs, at most 100 are retries -- the system can never generate more than 1.1x its normal load from retries. This is the approach used by Google's gRPC and the Google SRE book.\n\n### Deadline propagation\n\nPass the remaining time budget through the call chain; don't give each retry a fresh timeout.\n\n```typescript\nasync function handleRequest(req: Request) {\n  const deadline = Date.now() + 10_000; \u002F\u002F 10s total budget\n  const resultA = await callWithDeadline(serviceA.fetch, deadline);\n  const resultB = await callWithDeadline(serviceB.fetch, deadline); \u002F\u002F if A took 8s, B gets 2s\n  return combine(resultA, resultB);\n}\n\nasync function callWithDeadline\u003CT>(\n  fn: (timeoutMs: number) => Promise\u003CT>,\n  deadline: number,\n): Promise\u003CT> {\n  const remaining = deadline - Date.now();\n  if (remaining \u003C= 0) throw new DeadlineExceededError();\n  return fn(remaining);\n}\n```\n\nWithout propagation, a retry starting 8s into a 10s budget gets a fresh 10s timeout and the user waits 18s total. With it, the retry gets 2s and fails fast.\n\n### Load shedding (server-side protection)\n\nThe server rejects requests when overloaded instead of accepting them and being slow.\n\n```typescript\nclass LoadShedder {\n  private active = 0;\n  constructor(private maxConcurrent: number) {}\n\n  async handle\u003CT>(fn: () => Promise\u003CT>): Promise\u003CT> {\n    if (this.active >= this.maxConcurrent) throw new HttpError(503, \"Service overloaded\");\n    this.active++;\n    try { return await fn(); }\n    finally { this.active--; }\n  }\n}\n```\n\nA fast 503 tells the client \"try again later\" or \"try another instance\" instead of tying up its resources while it waits. Load shedding keeps accepted requests fast and healthy.\n\n## Anti-Patterns\n\n```typescript\n\u002F\u002F Retries all errors including 4xx; fixed interval, no jitter\nfor (let i = 0; i \u003C 3; i++) {\n  try { return await fetch(url); }\n  catch { await sleep(1000); }\n}\n\n\u002F\u002F Layer multiplication: 3 × 3 × 3 = 27 backend calls\ngateway: retry(3, () => serviceA())\nserviceA: retry(3, () => serviceB())\nserviceB: retry(3, () => database())\n\n\u002F\u002F Fresh timeout per retry: 30s × 4 attempts = 120s user wait\nfor (let i = 0; i \u003C 3; i++) {\n  try { return await callWithTimeout(service, 30_000); }\n  catch { continue; }\n}\n\n\u002F\u002F Library retries + app retries = silent multiplication\nconst axios = create({ retries: 3 });\nasync function call() { return retry(3, () => axios.get(url)); } \u002F\u002F 9 total\n```\n\n## Related Traps\n\n- **Thundering Herd** -- retries without jitter create thundering herds: all clients that failed together retry together. Exponential backoff with jitter is the same fix for both.\n- **Idempotency** -- every operation you retry MUST be idempotent. Retrying a payment without an idempotency key charges the customer multiple times. Retries and idempotency are inseparable.\n- **Distributed System Fallacies** -- fallacy #1 (the network is reliable) leads to both \"no retries\" and \"too many retries.\" The correct middle ground is limited, budgeted retries with circuit breakers.\n- **Backpressure** -- retries without budgets are a backpressure violation. Each retry adds work to an overwhelmed system instead of slowing down.\n",{"data":38,"body":39},{"name":4,"description":6},{"type":40,"children":41},"root",[42,51,63,70,75,88,93,99,104,113,118,126,132,140,213,219,226,559,730,736,1407,1420,1426,2227,2239,2245,2250,2727,2732,2738,2743,3269,3274,3280,3285,3629,3634,3640,4290,4296,4340],{"type":43,"tag":44,"props":45,"children":47},"element","h1",{"id":46},"retry-storms-trap",[48],{"type":49,"value":50},"text","Retry Storms Trap",{"type":43,"tag":52,"props":53,"children":54},"p",{},[55,57],{"type":49,"value":56},"The service is slow. Your retries made it slower. Before adding retry logic, ask: ",{"type":43,"tag":58,"props":59,"children":60},"strong",{},[61],{"type":49,"value":62},"what happens when every client retries at the same time against an already-struggling service?",{"type":43,"tag":64,"props":65,"children":67},"h2",{"id":66},"the-feedback-loop",[68],{"type":49,"value":69},"The Feedback Loop",{"type":43,"tag":52,"props":71,"children":72},{},[73],{"type":49,"value":74},"Retry storms are a positive feedback loop: worse performance draws more retries, which worsens performance, which draws more retries. The only stable states are \"working fine\" and \"completely dead.\"",{"type":43,"tag":76,"props":77,"children":81},"pre",{"className":78,"code":80,"language":49},[79],"language-text","Service slow → clients time out → retry → 2x load → slower\n  → more timeouts → more retries → 4x load → collapse\n",[82],{"type":43,"tag":83,"props":84,"children":86},"code",{"__ignoreMap":85},"",[87],{"type":49,"value":80},{"type":43,"tag":52,"props":89,"children":90},{},[91],{"type":49,"value":92},"The system can't recover under load because retries prevent the load from decreasing.",{"type":43,"tag":64,"props":94,"children":96},{"id":95},"the-layer-multiplication-problem",[97],{"type":49,"value":98},"The Layer Multiplication Problem",{"type":43,"tag":52,"props":100,"children":101},{},[102],{"type":49,"value":103},"Three layers of 3 retries = 27 backend calls for one user request.",{"type":43,"tag":76,"props":105,"children":108},{"className":106,"code":107,"language":49},[79],"User request\n  → Gateway 3x → Service A 3x → Service B 3x → Database\n        = 3 × 3 × 3 = 27 database queries\n",[109],{"type":43,"tag":83,"props":110,"children":111},{"__ignoreMap":85},[112],{"type":49,"value":107},{"type":43,"tag":52,"props":114,"children":115},{},[116],{"type":49,"value":117},"Each layer multiplies independently. An agent adding \"just 3 retries\" to Service A doesn't know Service B already has 3. Nobody calculated the total.",{"type":43,"tag":52,"props":119,"children":120},{},[121],{"type":43,"tag":58,"props":122,"children":123},{},[124],{"type":49,"value":125},"Before adding retries, count the total retry multiplication across the full call chain.",{"type":43,"tag":64,"props":127,"children":129},{"id":128},"detection-when-youre-building-a-retry-storm",[130],{"type":49,"value":131},"Detection: When You're Building a Retry Storm",{"type":43,"tag":52,"props":133,"children":134},{},[135],{"type":43,"tag":58,"props":136,"children":137},{},[138],{"type":49,"value":139},"Stop and fix if you see:",{"type":43,"tag":141,"props":142,"children":143},"ol",{},[144,155,165,183,193,203],{"type":43,"tag":145,"props":146,"children":147},"li",{},[148,153],{"type":43,"tag":58,"props":149,"children":150},{},[151],{"type":49,"value":152},"Retry logic at multiple layers",{"type":49,"value":154}," -- calculate worst-case total. More than ~10 for one user request is too many. Retry at ONE layer, ideally the outermost.",{"type":43,"tag":145,"props":156,"children":157},{},[158,163],{"type":43,"tag":58,"props":159,"children":160},{},[161],{"type":49,"value":162},"Retrying all errors, including 4xx",{"type":49,"value":164}," -- 400\u002F401\u002F409 will never succeed on retry. Only retry 5xx, 429, 408, and network errors.",{"type":43,"tag":145,"props":166,"children":167},{},[168,173,175,181],{"type":43,"tag":58,"props":169,"children":170},{},[171],{"type":49,"value":172},"Fixed-interval retries or no backoff",{"type":49,"value":174}," -- ",{"type":43,"tag":83,"props":176,"children":178},{"className":177},[],[179],{"type":49,"value":180},"sleep(1000)",{"type":49,"value":182}," makes all clients retry the same second. Use exponential backoff with jitter.",{"type":43,"tag":145,"props":184,"children":185},{},[186,191],{"type":43,"tag":58,"props":187,"children":188},{},[189],{"type":49,"value":190},"Retries without a circuit breaker",{"type":49,"value":192}," -- retries into a dead service generate load that prevents recovery. A breaker stops sending after repeated failures, giving the service time to recover.",{"type":43,"tag":145,"props":194,"children":195},{},[196,201],{"type":43,"tag":58,"props":197,"children":198},{},[199],{"type":49,"value":200},"Timeout × retry count exceeds the user's patience",{"type":49,"value":202}," -- 30s × 3 = 120s worst case; is the user still waiting? Each retry should use the remaining deadline, not a fresh timeout.",{"type":43,"tag":145,"props":204,"children":205},{},[206,211],{"type":43,"tag":58,"props":207,"children":208},{},[209],{"type":49,"value":210},"Retry logic in both the HTTP client library and application code",{"type":49,"value":212}," -- Axios, AWS SDK, gRPC retry by default. App-level retries on top multiply silently. Check your client's default retry config.",{"type":43,"tag":64,"props":214,"children":216},{"id":215},"patterns",[217],{"type":49,"value":218},"Patterns",{"type":43,"tag":220,"props":221,"children":223},"h3",{"id":222},"only-retry-retriable-errors",[224],{"type":49,"value":225},"Only retry retriable errors",{"type":43,"tag":76,"props":227,"children":231},{"className":228,"code":229,"language":230,"meta":85,"style":85},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","function isRetriable(error: unknown): boolean {\n  if (error instanceof HttpError) {\n    return error.status >= 500 || error.status === 429 || error.status === 408;\n  }\n  \u002F\u002F Network errors (connection refused, DNS failure, TCP reset)\n  if (error instanceof TypeError && error.message.includes(\"fetch\")) return true;\n  return false;\n}\n","typescript",[232],{"type":43,"tag":83,"props":233,"children":234},{"__ignoreMap":85},[235,290,331,422,431,441,532,550],{"type":43,"tag":236,"props":237,"children":239},"span",{"class":238,"line":30},"line",[240,246,252,258,264,269,275,280,285],{"type":43,"tag":236,"props":241,"children":243},{"style":242},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[244],{"type":49,"value":245},"function",{"type":43,"tag":236,"props":247,"children":249},{"style":248},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[250],{"type":49,"value":251}," isRetriable",{"type":43,"tag":236,"props":253,"children":255},{"style":254},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[256],{"type":49,"value":257},"(",{"type":43,"tag":236,"props":259,"children":261},{"style":260},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[262],{"type":49,"value":263},"error",{"type":43,"tag":236,"props":265,"children":266},{"style":254},[267],{"type":49,"value":268},":",{"type":43,"tag":236,"props":270,"children":272},{"style":271},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[273],{"type":49,"value":274}," unknown",{"type":43,"tag":236,"props":276,"children":277},{"style":254},[278],{"type":49,"value":279},"):",{"type":43,"tag":236,"props":281,"children":282},{"style":271},[283],{"type":49,"value":284}," boolean",{"type":43,"tag":236,"props":286,"children":287},{"style":254},[288],{"type":49,"value":289}," {\n",{"type":43,"tag":236,"props":291,"children":293},{"class":238,"line":292},2,[294,300,306,311,316,321,326],{"type":43,"tag":236,"props":295,"children":297},{"style":296},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[298],{"type":49,"value":299},"  if",{"type":43,"tag":236,"props":301,"children":303},{"style":302},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[304],{"type":49,"value":305}," (",{"type":43,"tag":236,"props":307,"children":309},{"style":308},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[310],{"type":49,"value":263},{"type":43,"tag":236,"props":312,"children":313},{"style":254},[314],{"type":49,"value":315}," instanceof",{"type":43,"tag":236,"props":317,"children":318},{"style":271},[319],{"type":49,"value":320}," HttpError",{"type":43,"tag":236,"props":322,"children":323},{"style":302},[324],{"type":49,"value":325},") ",{"type":43,"tag":236,"props":327,"children":328},{"style":254},[329],{"type":49,"value":330},"{\n",{"type":43,"tag":236,"props":332,"children":333},{"class":238,"line":26},[334,339,344,349,354,359,365,370,374,378,382,387,392,396,400,404,408,412,417],{"type":43,"tag":236,"props":335,"children":336},{"style":296},[337],{"type":49,"value":338},"    return",{"type":43,"tag":236,"props":340,"children":341},{"style":308},[342],{"type":49,"value":343}," error",{"type":43,"tag":236,"props":345,"children":346},{"style":254},[347],{"type":49,"value":348},".",{"type":43,"tag":236,"props":350,"children":351},{"style":308},[352],{"type":49,"value":353},"status",{"type":43,"tag":236,"props":355,"children":356},{"style":254},[357],{"type":49,"value":358}," >=",{"type":43,"tag":236,"props":360,"children":362},{"style":361},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[363],{"type":49,"value":364}," 500",{"type":43,"tag":236,"props":366,"children":367},{"style":254},[368],{"type":49,"value":369}," ||",{"type":43,"tag":236,"props":371,"children":372},{"style":308},[373],{"type":49,"value":343},{"type":43,"tag":236,"props":375,"children":376},{"style":254},[377],{"type":49,"value":348},{"type":43,"tag":236,"props":379,"children":380},{"style":308},[381],{"type":49,"value":353},{"type":43,"tag":236,"props":383,"children":384},{"style":254},[385],{"type":49,"value":386}," ===",{"type":43,"tag":236,"props":388,"children":389},{"style":361},[390],{"type":49,"value":391}," 429",{"type":43,"tag":236,"props":393,"children":394},{"style":254},[395],{"type":49,"value":369},{"type":43,"tag":236,"props":397,"children":398},{"style":308},[399],{"type":49,"value":343},{"type":43,"tag":236,"props":401,"children":402},{"style":254},[403],{"type":49,"value":348},{"type":43,"tag":236,"props":405,"children":406},{"style":308},[407],{"type":49,"value":353},{"type":43,"tag":236,"props":409,"children":410},{"style":254},[411],{"type":49,"value":386},{"type":43,"tag":236,"props":413,"children":414},{"style":361},[415],{"type":49,"value":416}," 408",{"type":43,"tag":236,"props":418,"children":419},{"style":254},[420],{"type":49,"value":421},";\n",{"type":43,"tag":236,"props":423,"children":425},{"class":238,"line":424},4,[426],{"type":43,"tag":236,"props":427,"children":428},{"style":254},[429],{"type":49,"value":430},"  }\n",{"type":43,"tag":236,"props":432,"children":434},{"class":238,"line":433},5,[435],{"type":43,"tag":236,"props":436,"children":438},{"style":437},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[439],{"type":49,"value":440},"  \u002F\u002F Network errors (connection refused, DNS failure, TCP reset)\n",{"type":43,"tag":236,"props":442,"children":444},{"class":238,"line":443},6,[445,449,453,457,461,466,471,475,479,484,488,493,497,502,508,512,517,522,528],{"type":43,"tag":236,"props":446,"children":447},{"style":296},[448],{"type":49,"value":299},{"type":43,"tag":236,"props":450,"children":451},{"style":302},[452],{"type":49,"value":305},{"type":43,"tag":236,"props":454,"children":455},{"style":308},[456],{"type":49,"value":263},{"type":43,"tag":236,"props":458,"children":459},{"style":254},[460],{"type":49,"value":315},{"type":43,"tag":236,"props":462,"children":463},{"style":271},[464],{"type":49,"value":465}," TypeError",{"type":43,"tag":236,"props":467,"children":468},{"style":254},[469],{"type":49,"value":470}," &&",{"type":43,"tag":236,"props":472,"children":473},{"style":308},[474],{"type":49,"value":343},{"type":43,"tag":236,"props":476,"children":477},{"style":254},[478],{"type":49,"value":348},{"type":43,"tag":236,"props":480,"children":481},{"style":308},[482],{"type":49,"value":483},"message",{"type":43,"tag":236,"props":485,"children":486},{"style":254},[487],{"type":49,"value":348},{"type":43,"tag":236,"props":489,"children":490},{"style":248},[491],{"type":49,"value":492},"includes",{"type":43,"tag":236,"props":494,"children":495},{"style":302},[496],{"type":49,"value":257},{"type":43,"tag":236,"props":498,"children":499},{"style":254},[500],{"type":49,"value":501},"\"",{"type":43,"tag":236,"props":503,"children":505},{"style":504},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[506],{"type":49,"value":507},"fetch",{"type":43,"tag":236,"props":509,"children":510},{"style":254},[511],{"type":49,"value":501},{"type":43,"tag":236,"props":513,"children":514},{"style":302},[515],{"type":49,"value":516},")) ",{"type":43,"tag":236,"props":518,"children":519},{"style":296},[520],{"type":49,"value":521},"return",{"type":43,"tag":236,"props":523,"children":525},{"style":524},"--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC",[526],{"type":49,"value":527}," true",{"type":43,"tag":236,"props":529,"children":530},{"style":254},[531],{"type":49,"value":421},{"type":43,"tag":236,"props":533,"children":535},{"class":238,"line":534},7,[536,541,546],{"type":43,"tag":236,"props":537,"children":538},{"style":296},[539],{"type":49,"value":540},"  return",{"type":43,"tag":236,"props":542,"children":543},{"style":524},[544],{"type":49,"value":545}," false",{"type":43,"tag":236,"props":547,"children":548},{"style":254},[549],{"type":49,"value":421},{"type":43,"tag":236,"props":551,"children":553},{"class":238,"line":552},8,[554],{"type":43,"tag":236,"props":555,"children":556},{"style":254},[557],{"type":49,"value":558},"}\n",{"type":43,"tag":560,"props":561,"children":562},"table",{},[563,587],{"type":43,"tag":564,"props":565,"children":566},"thead",{},[567],{"type":43,"tag":568,"props":569,"children":570},"tr",{},[571,577,582],{"type":43,"tag":572,"props":573,"children":574},"th",{},[575],{"type":49,"value":576},"Status",{"type":43,"tag":572,"props":578,"children":579},{},[580],{"type":49,"value":581},"Retry?",{"type":43,"tag":572,"props":583,"children":584},{},[585],{"type":49,"value":586},"Why",{"type":43,"tag":588,"props":589,"children":590},"tbody",{},[591,610,627,644,661,679,696,713],{"type":43,"tag":568,"props":592,"children":593},{},[594,600,605],{"type":43,"tag":595,"props":596,"children":597},"td",{},[598],{"type":49,"value":599},"400 \u002F 422",{"type":43,"tag":595,"props":601,"children":602},{},[603],{"type":49,"value":604},"No",{"type":43,"tag":595,"props":606,"children":607},{},[608],{"type":49,"value":609},"Input\u002Fvalidation wrong, won't change",{"type":43,"tag":568,"props":611,"children":612},{},[613,618,622],{"type":43,"tag":595,"props":614,"children":615},{},[616],{"type":49,"value":617},"401 \u002F 403",{"type":43,"tag":595,"props":619,"children":620},{},[621],{"type":49,"value":604},{"type":43,"tag":595,"props":623,"children":624},{},[625],{"type":49,"value":626},"Credentials wrong \u002F permission denied",{"type":43,"tag":568,"props":628,"children":629},{},[630,635,639],{"type":43,"tag":595,"props":631,"children":632},{},[633],{"type":49,"value":634},"404",{"type":43,"tag":595,"props":636,"children":637},{},[638],{"type":49,"value":604},{"type":43,"tag":595,"props":640,"children":641},{},[642],{"type":49,"value":643},"Resource doesn't exist",{"type":43,"tag":568,"props":645,"children":646},{},[647,652,656],{"type":43,"tag":595,"props":648,"children":649},{},[650],{"type":49,"value":651},"409 Conflict",{"type":43,"tag":595,"props":653,"children":654},{},[655],{"type":49,"value":604},{"type":43,"tag":595,"props":657,"children":658},{},[659],{"type":49,"value":660},"Operation already happened or state conflict",{"type":43,"tag":568,"props":662,"children":663},{},[664,669,674],{"type":43,"tag":595,"props":665,"children":666},{},[667],{"type":49,"value":668},"429 Too Many Requests",{"type":43,"tag":595,"props":670,"children":671},{},[672],{"type":49,"value":673},"Yes",{"type":43,"tag":595,"props":675,"children":676},{},[677],{"type":49,"value":678},"Rate limited, back off and retry",{"type":43,"tag":568,"props":680,"children":681},{},[682,687,691],{"type":43,"tag":595,"props":683,"children":684},{},[685],{"type":49,"value":686},"408 Request Timeout",{"type":43,"tag":595,"props":688,"children":689},{},[690],{"type":49,"value":673},{"type":43,"tag":595,"props":692,"children":693},{},[694],{"type":49,"value":695},"Server timed out, may work on retry",{"type":43,"tag":568,"props":697,"children":698},{},[699,704,708],{"type":43,"tag":595,"props":700,"children":701},{},[702],{"type":49,"value":703},"500+ Server Error",{"type":43,"tag":595,"props":705,"children":706},{},[707],{"type":49,"value":673},{"type":43,"tag":595,"props":709,"children":710},{},[711],{"type":49,"value":712},"Transient server issue",{"type":43,"tag":568,"props":714,"children":715},{},[716,721,725],{"type":43,"tag":595,"props":717,"children":718},{},[719],{"type":49,"value":720},"Network error",{"type":43,"tag":595,"props":722,"children":723},{},[724],{"type":49,"value":673},{"type":43,"tag":595,"props":726,"children":727},{},[728],{"type":49,"value":729},"Connection failed, may work on retry",{"type":43,"tag":220,"props":731,"children":733},{"id":732},"exponential-backoff-with-full-jitter",[734],{"type":49,"value":735},"Exponential backoff with full jitter",{"type":43,"tag":76,"props":737,"children":739},{"className":228,"code":738,"language":230,"meta":85,"style":85},"async function retryWithBackoff\u003CT>(\n  fn: () => Promise\u003CT>,\n  options: { maxRetries?: number; baseDelayMs?: number } = {},\n): Promise\u003CT> {\n  const { maxRetries = 3, baseDelayMs = 200 } = options;\n\n  for (let attempt = 0; attempt \u003C= maxRetries; attempt++) {\n    try {\n      return await fn();\n    } catch (error) {\n      if (attempt === maxRetries || !isRetriable(error)) throw error;\n      \u002F\u002F Full jitter: random point in the exponential window\n      const delay = Math.random() * (baseDelayMs * 2 ** attempt);\n      await new Promise((r) => setTimeout(r, delay));\n    }\n  }\n  throw new Error(\"unreachable\");\n}\n",[740],{"type":43,"tag":83,"props":741,"children":742},{"__ignoreMap":85},[743,776,816,881,909,969,978,1047,1059,1087,1117,1182,1191,1270,1339,1348,1356,1399],{"type":43,"tag":236,"props":744,"children":745},{"class":238,"line":30},[746,751,756,761,766,771],{"type":43,"tag":236,"props":747,"children":748},{"style":242},[749],{"type":49,"value":750},"async",{"type":43,"tag":236,"props":752,"children":753},{"style":242},[754],{"type":49,"value":755}," function",{"type":43,"tag":236,"props":757,"children":758},{"style":248},[759],{"type":49,"value":760}," retryWithBackoff",{"type":43,"tag":236,"props":762,"children":763},{"style":254},[764],{"type":49,"value":765},"\u003C",{"type":43,"tag":236,"props":767,"children":768},{"style":271},[769],{"type":49,"value":770},"T",{"type":43,"tag":236,"props":772,"children":773},{"style":254},[774],{"type":49,"value":775},">(\n",{"type":43,"tag":236,"props":777,"children":778},{"class":238,"line":292},[779,784,788,793,798,803,807,811],{"type":43,"tag":236,"props":780,"children":781},{"style":248},[782],{"type":49,"value":783},"  fn",{"type":43,"tag":236,"props":785,"children":786},{"style":254},[787],{"type":49,"value":268},{"type":43,"tag":236,"props":789,"children":790},{"style":254},[791],{"type":49,"value":792}," ()",{"type":43,"tag":236,"props":794,"children":795},{"style":242},[796],{"type":49,"value":797}," =>",{"type":43,"tag":236,"props":799,"children":800},{"style":271},[801],{"type":49,"value":802}," Promise",{"type":43,"tag":236,"props":804,"children":805},{"style":254},[806],{"type":49,"value":765},{"type":43,"tag":236,"props":808,"children":809},{"style":271},[810],{"type":49,"value":770},{"type":43,"tag":236,"props":812,"children":813},{"style":254},[814],{"type":49,"value":815},">,\n",{"type":43,"tag":236,"props":817,"children":818},{"class":238,"line":26},[819,824,828,833,838,843,848,853,858,862,866,871,876],{"type":43,"tag":236,"props":820,"children":821},{"style":260},[822],{"type":49,"value":823},"  options",{"type":43,"tag":236,"props":825,"children":826},{"style":254},[827],{"type":49,"value":268},{"type":43,"tag":236,"props":829,"children":830},{"style":254},[831],{"type":49,"value":832}," {",{"type":43,"tag":236,"props":834,"children":835},{"style":302},[836],{"type":49,"value":837}," maxRetries",{"type":43,"tag":236,"props":839,"children":840},{"style":254},[841],{"type":49,"value":842},"?:",{"type":43,"tag":236,"props":844,"children":845},{"style":271},[846],{"type":49,"value":847}," number",{"type":43,"tag":236,"props":849,"children":850},{"style":254},[851],{"type":49,"value":852},";",{"type":43,"tag":236,"props":854,"children":855},{"style":302},[856],{"type":49,"value":857}," baseDelayMs",{"type":43,"tag":236,"props":859,"children":860},{"style":254},[861],{"type":49,"value":842},{"type":43,"tag":236,"props":863,"children":864},{"style":271},[865],{"type":49,"value":847},{"type":43,"tag":236,"props":867,"children":868},{"style":254},[869],{"type":49,"value":870}," }",{"type":43,"tag":236,"props":872,"children":873},{"style":254},[874],{"type":49,"value":875}," =",{"type":43,"tag":236,"props":877,"children":878},{"style":254},[879],{"type":49,"value":880}," {},\n",{"type":43,"tag":236,"props":882,"children":883},{"class":238,"line":424},[884,888,892,896,900,905],{"type":43,"tag":236,"props":885,"children":886},{"style":254},[887],{"type":49,"value":279},{"type":43,"tag":236,"props":889,"children":890},{"style":271},[891],{"type":49,"value":802},{"type":43,"tag":236,"props":893,"children":894},{"style":254},[895],{"type":49,"value":765},{"type":43,"tag":236,"props":897,"children":898},{"style":271},[899],{"type":49,"value":770},{"type":43,"tag":236,"props":901,"children":902},{"style":254},[903],{"type":49,"value":904},">",{"type":43,"tag":236,"props":906,"children":907},{"style":254},[908],{"type":49,"value":289},{"type":43,"tag":236,"props":910,"children":911},{"class":238,"line":433},[912,917,921,925,929,934,939,943,947,952,956,960,965],{"type":43,"tag":236,"props":913,"children":914},{"style":242},[915],{"type":49,"value":916},"  const",{"type":43,"tag":236,"props":918,"children":919},{"style":254},[920],{"type":49,"value":832},{"type":43,"tag":236,"props":922,"children":923},{"style":308},[924],{"type":49,"value":837},{"type":43,"tag":236,"props":926,"children":927},{"style":254},[928],{"type":49,"value":875},{"type":43,"tag":236,"props":930,"children":931},{"style":361},[932],{"type":49,"value":933}," 3",{"type":43,"tag":236,"props":935,"children":936},{"style":254},[937],{"type":49,"value":938},",",{"type":43,"tag":236,"props":940,"children":941},{"style":308},[942],{"type":49,"value":857},{"type":43,"tag":236,"props":944,"children":945},{"style":254},[946],{"type":49,"value":875},{"type":43,"tag":236,"props":948,"children":949},{"style":361},[950],{"type":49,"value":951}," 200",{"type":43,"tag":236,"props":953,"children":954},{"style":254},[955],{"type":49,"value":870},{"type":43,"tag":236,"props":957,"children":958},{"style":254},[959],{"type":49,"value":875},{"type":43,"tag":236,"props":961,"children":962},{"style":308},[963],{"type":49,"value":964}," options",{"type":43,"tag":236,"props":966,"children":967},{"style":254},[968],{"type":49,"value":421},{"type":43,"tag":236,"props":970,"children":971},{"class":238,"line":443},[972],{"type":43,"tag":236,"props":973,"children":975},{"emptyLinePlaceholder":974},true,[976],{"type":49,"value":977},"\n",{"type":43,"tag":236,"props":979,"children":980},{"class":238,"line":534},[981,986,990,995,1000,1004,1009,1013,1017,1022,1026,1030,1034,1039,1043],{"type":43,"tag":236,"props":982,"children":983},{"style":296},[984],{"type":49,"value":985},"  for",{"type":43,"tag":236,"props":987,"children":988},{"style":302},[989],{"type":49,"value":305},{"type":43,"tag":236,"props":991,"children":992},{"style":242},[993],{"type":49,"value":994},"let",{"type":43,"tag":236,"props":996,"children":997},{"style":308},[998],{"type":49,"value":999}," attempt",{"type":43,"tag":236,"props":1001,"children":1002},{"style":254},[1003],{"type":49,"value":875},{"type":43,"tag":236,"props":1005,"children":1006},{"style":361},[1007],{"type":49,"value":1008}," 0",{"type":43,"tag":236,"props":1010,"children":1011},{"style":254},[1012],{"type":49,"value":852},{"type":43,"tag":236,"props":1014,"children":1015},{"style":308},[1016],{"type":49,"value":999},{"type":43,"tag":236,"props":1018,"children":1019},{"style":254},[1020],{"type":49,"value":1021}," \u003C=",{"type":43,"tag":236,"props":1023,"children":1024},{"style":308},[1025],{"type":49,"value":837},{"type":43,"tag":236,"props":1027,"children":1028},{"style":254},[1029],{"type":49,"value":852},{"type":43,"tag":236,"props":1031,"children":1032},{"style":308},[1033],{"type":49,"value":999},{"type":43,"tag":236,"props":1035,"children":1036},{"style":254},[1037],{"type":49,"value":1038},"++",{"type":43,"tag":236,"props":1040,"children":1041},{"style":302},[1042],{"type":49,"value":325},{"type":43,"tag":236,"props":1044,"children":1045},{"style":254},[1046],{"type":49,"value":330},{"type":43,"tag":236,"props":1048,"children":1049},{"class":238,"line":552},[1050,1055],{"type":43,"tag":236,"props":1051,"children":1052},{"style":296},[1053],{"type":49,"value":1054},"    try",{"type":43,"tag":236,"props":1056,"children":1057},{"style":254},[1058],{"type":49,"value":289},{"type":43,"tag":236,"props":1060,"children":1062},{"class":238,"line":1061},9,[1063,1068,1073,1078,1083],{"type":43,"tag":236,"props":1064,"children":1065},{"style":296},[1066],{"type":49,"value":1067},"      return",{"type":43,"tag":236,"props":1069,"children":1070},{"style":296},[1071],{"type":49,"value":1072}," await",{"type":43,"tag":236,"props":1074,"children":1075},{"style":248},[1076],{"type":49,"value":1077}," fn",{"type":43,"tag":236,"props":1079,"children":1080},{"style":302},[1081],{"type":49,"value":1082},"()",{"type":43,"tag":236,"props":1084,"children":1085},{"style":254},[1086],{"type":49,"value":421},{"type":43,"tag":236,"props":1088,"children":1090},{"class":238,"line":1089},10,[1091,1096,1101,1105,1109,1113],{"type":43,"tag":236,"props":1092,"children":1093},{"style":254},[1094],{"type":49,"value":1095},"    }",{"type":43,"tag":236,"props":1097,"children":1098},{"style":296},[1099],{"type":49,"value":1100}," catch",{"type":43,"tag":236,"props":1102,"children":1103},{"style":302},[1104],{"type":49,"value":305},{"type":43,"tag":236,"props":1106,"children":1107},{"style":308},[1108],{"type":49,"value":263},{"type":43,"tag":236,"props":1110,"children":1111},{"style":302},[1112],{"type":49,"value":325},{"type":43,"tag":236,"props":1114,"children":1115},{"style":254},[1116],{"type":49,"value":330},{"type":43,"tag":236,"props":1118,"children":1120},{"class":238,"line":1119},11,[1121,1126,1130,1135,1139,1143,1147,1152,1157,1161,1165,1169,1174,1178],{"type":43,"tag":236,"props":1122,"children":1123},{"style":296},[1124],{"type":49,"value":1125},"      if",{"type":43,"tag":236,"props":1127,"children":1128},{"style":302},[1129],{"type":49,"value":305},{"type":43,"tag":236,"props":1131,"children":1132},{"style":308},[1133],{"type":49,"value":1134},"attempt",{"type":43,"tag":236,"props":1136,"children":1137},{"style":254},[1138],{"type":49,"value":386},{"type":43,"tag":236,"props":1140,"children":1141},{"style":308},[1142],{"type":49,"value":837},{"type":43,"tag":236,"props":1144,"children":1145},{"style":254},[1146],{"type":49,"value":369},{"type":43,"tag":236,"props":1148,"children":1149},{"style":254},[1150],{"type":49,"value":1151}," !",{"type":43,"tag":236,"props":1153,"children":1154},{"style":248},[1155],{"type":49,"value":1156},"isRetriable",{"type":43,"tag":236,"props":1158,"children":1159},{"style":302},[1160],{"type":49,"value":257},{"type":43,"tag":236,"props":1162,"children":1163},{"style":308},[1164],{"type":49,"value":263},{"type":43,"tag":236,"props":1166,"children":1167},{"style":302},[1168],{"type":49,"value":516},{"type":43,"tag":236,"props":1170,"children":1171},{"style":296},[1172],{"type":49,"value":1173},"throw",{"type":43,"tag":236,"props":1175,"children":1176},{"style":308},[1177],{"type":49,"value":343},{"type":43,"tag":236,"props":1179,"children":1180},{"style":254},[1181],{"type":49,"value":421},{"type":43,"tag":236,"props":1183,"children":1185},{"class":238,"line":1184},12,[1186],{"type":43,"tag":236,"props":1187,"children":1188},{"style":437},[1189],{"type":49,"value":1190},"      \u002F\u002F Full jitter: random point in the exponential window\n",{"type":43,"tag":236,"props":1192,"children":1194},{"class":238,"line":1193},13,[1195,1200,1205,1209,1214,1218,1223,1228,1233,1237,1242,1247,1252,1257,1261,1266],{"type":43,"tag":236,"props":1196,"children":1197},{"style":242},[1198],{"type":49,"value":1199},"      const",{"type":43,"tag":236,"props":1201,"children":1202},{"style":308},[1203],{"type":49,"value":1204}," delay",{"type":43,"tag":236,"props":1206,"children":1207},{"style":254},[1208],{"type":49,"value":875},{"type":43,"tag":236,"props":1210,"children":1211},{"style":308},[1212],{"type":49,"value":1213}," Math",{"type":43,"tag":236,"props":1215,"children":1216},{"style":254},[1217],{"type":49,"value":348},{"type":43,"tag":236,"props":1219,"children":1220},{"style":248},[1221],{"type":49,"value":1222},"random",{"type":43,"tag":236,"props":1224,"children":1225},{"style":302},[1226],{"type":49,"value":1227},"() ",{"type":43,"tag":236,"props":1229,"children":1230},{"style":254},[1231],{"type":49,"value":1232},"*",{"type":43,"tag":236,"props":1234,"children":1235},{"style":302},[1236],{"type":49,"value":305},{"type":43,"tag":236,"props":1238,"children":1239},{"style":308},[1240],{"type":49,"value":1241},"baseDelayMs",{"type":43,"tag":236,"props":1243,"children":1244},{"style":254},[1245],{"type":49,"value":1246}," *",{"type":43,"tag":236,"props":1248,"children":1249},{"style":361},[1250],{"type":49,"value":1251}," 2",{"type":43,"tag":236,"props":1253,"children":1254},{"style":254},[1255],{"type":49,"value":1256}," **",{"type":43,"tag":236,"props":1258,"children":1259},{"style":308},[1260],{"type":49,"value":999},{"type":43,"tag":236,"props":1262,"children":1263},{"style":302},[1264],{"type":49,"value":1265},")",{"type":43,"tag":236,"props":1267,"children":1268},{"style":254},[1269],{"type":49,"value":421},{"type":43,"tag":236,"props":1271,"children":1273},{"class":238,"line":1272},14,[1274,1279,1284,1288,1292,1296,1301,1305,1309,1314,1318,1322,1326,1330,1335],{"type":43,"tag":236,"props":1275,"children":1276},{"style":296},[1277],{"type":49,"value":1278},"      await",{"type":43,"tag":236,"props":1280,"children":1281},{"style":254},[1282],{"type":49,"value":1283}," new",{"type":43,"tag":236,"props":1285,"children":1286},{"style":271},[1287],{"type":49,"value":802},{"type":43,"tag":236,"props":1289,"children":1290},{"style":302},[1291],{"type":49,"value":257},{"type":43,"tag":236,"props":1293,"children":1294},{"style":254},[1295],{"type":49,"value":257},{"type":43,"tag":236,"props":1297,"children":1298},{"style":260},[1299],{"type":49,"value":1300},"r",{"type":43,"tag":236,"props":1302,"children":1303},{"style":254},[1304],{"type":49,"value":1265},{"type":43,"tag":236,"props":1306,"children":1307},{"style":242},[1308],{"type":49,"value":797},{"type":43,"tag":236,"props":1310,"children":1311},{"style":248},[1312],{"type":49,"value":1313}," setTimeout",{"type":43,"tag":236,"props":1315,"children":1316},{"style":302},[1317],{"type":49,"value":257},{"type":43,"tag":236,"props":1319,"children":1320},{"style":308},[1321],{"type":49,"value":1300},{"type":43,"tag":236,"props":1323,"children":1324},{"style":254},[1325],{"type":49,"value":938},{"type":43,"tag":236,"props":1327,"children":1328},{"style":308},[1329],{"type":49,"value":1204},{"type":43,"tag":236,"props":1331,"children":1332},{"style":302},[1333],{"type":49,"value":1334},"))",{"type":43,"tag":236,"props":1336,"children":1337},{"style":254},[1338],{"type":49,"value":421},{"type":43,"tag":236,"props":1340,"children":1342},{"class":238,"line":1341},15,[1343],{"type":43,"tag":236,"props":1344,"children":1345},{"style":254},[1346],{"type":49,"value":1347},"    }\n",{"type":43,"tag":236,"props":1349,"children":1351},{"class":238,"line":1350},16,[1352],{"type":43,"tag":236,"props":1353,"children":1354},{"style":254},[1355],{"type":49,"value":430},{"type":43,"tag":236,"props":1357,"children":1359},{"class":238,"line":1358},17,[1360,1365,1369,1374,1378,1382,1387,1391,1395],{"type":43,"tag":236,"props":1361,"children":1362},{"style":296},[1363],{"type":49,"value":1364},"  throw",{"type":43,"tag":236,"props":1366,"children":1367},{"style":254},[1368],{"type":49,"value":1283},{"type":43,"tag":236,"props":1370,"children":1371},{"style":248},[1372],{"type":49,"value":1373}," Error",{"type":43,"tag":236,"props":1375,"children":1376},{"style":302},[1377],{"type":49,"value":257},{"type":43,"tag":236,"props":1379,"children":1380},{"style":254},[1381],{"type":49,"value":501},{"type":43,"tag":236,"props":1383,"children":1384},{"style":504},[1385],{"type":49,"value":1386},"unreachable",{"type":43,"tag":236,"props":1388,"children":1389},{"style":254},[1390],{"type":49,"value":501},{"type":43,"tag":236,"props":1392,"children":1393},{"style":302},[1394],{"type":49,"value":1265},{"type":43,"tag":236,"props":1396,"children":1397},{"style":254},[1398],{"type":49,"value":421},{"type":43,"tag":236,"props":1400,"children":1402},{"class":238,"line":1401},18,[1403],{"type":43,"tag":236,"props":1404,"children":1405},{"style":254},[1406],{"type":49,"value":558},{"type":43,"tag":52,"props":1408,"children":1409},{},[1410,1412,1418],{"type":49,"value":1411},"Full jitter (",{"type":43,"tag":83,"props":1413,"children":1415},{"className":1414},[],[1416],{"type":49,"value":1417},"random * maxDelay",{"type":49,"value":1419},") spreads retries across the entire backoff window. Without jitter, all clients that failed together retry together -- a thundering herd of retries.",{"type":43,"tag":220,"props":1421,"children":1423},{"id":1422},"circuit-breaker-stop-retrying-into-a-dead-service",[1424],{"type":49,"value":1425},"Circuit breaker (stop retrying into a dead service)",{"type":43,"tag":76,"props":1427,"children":1429},{"className":228,"code":1428,"language":230,"meta":85,"style":85},"class CircuitBreaker {\n  private failures = 0;\n  private lastFailure = 0;\n  private state: \"closed\" | \"open\" | \"half-open\" = \"closed\";\n\n  constructor(private threshold = 5, private resetMs = 30_000) {}\n\n  async call\u003CT>(fn: () => Promise\u003CT>): Promise\u003CT> {\n    if (this.state === \"open\") {\n      if (Date.now() - this.lastFailure > this.resetMs) this.state = \"half-open\"; \u002F\u002F allow one test\n      else throw new CircuitBreakerOpenError(); \u002F\u002F fail fast\n    }\n    try {\n      const result = await fn();\n      this.failures = 0;\n      this.state = \"closed\";\n      return result;\n    } catch (err) {\n      this.failures++;\n      this.lastFailure = Date.now();\n      if (this.failures >= this.threshold) this.state = \"open\";\n      throw err;\n    }\n  }\n}\n",[1430],{"type":43,"tag":83,"props":1431,"children":1432},{"__ignoreMap":85},[1433,1450,1475,1499,1584,1591,1654,1661,1741,1787,1882,1917,1924,1935,1967,1992,2023,2038,2066,2083,2120,2185,2203,2211,2219],{"type":43,"tag":236,"props":1434,"children":1435},{"class":238,"line":30},[1436,1441,1446],{"type":43,"tag":236,"props":1437,"children":1438},{"style":242},[1439],{"type":49,"value":1440},"class",{"type":43,"tag":236,"props":1442,"children":1443},{"style":271},[1444],{"type":49,"value":1445}," CircuitBreaker",{"type":43,"tag":236,"props":1447,"children":1448},{"style":254},[1449],{"type":49,"value":289},{"type":43,"tag":236,"props":1451,"children":1452},{"class":238,"line":292},[1453,1458,1463,1467,1471],{"type":43,"tag":236,"props":1454,"children":1455},{"style":242},[1456],{"type":49,"value":1457},"  private",{"type":43,"tag":236,"props":1459,"children":1460},{"style":302},[1461],{"type":49,"value":1462}," failures",{"type":43,"tag":236,"props":1464,"children":1465},{"style":254},[1466],{"type":49,"value":875},{"type":43,"tag":236,"props":1468,"children":1469},{"style":361},[1470],{"type":49,"value":1008},{"type":43,"tag":236,"props":1472,"children":1473},{"style":254},[1474],{"type":49,"value":421},{"type":43,"tag":236,"props":1476,"children":1477},{"class":238,"line":26},[1478,1482,1487,1491,1495],{"type":43,"tag":236,"props":1479,"children":1480},{"style":242},[1481],{"type":49,"value":1457},{"type":43,"tag":236,"props":1483,"children":1484},{"style":302},[1485],{"type":49,"value":1486}," lastFailure",{"type":43,"tag":236,"props":1488,"children":1489},{"style":254},[1490],{"type":49,"value":875},{"type":43,"tag":236,"props":1492,"children":1493},{"style":361},[1494],{"type":49,"value":1008},{"type":43,"tag":236,"props":1496,"children":1497},{"style":254},[1498],{"type":49,"value":421},{"type":43,"tag":236,"props":1500,"children":1501},{"class":238,"line":424},[1502,1506,1511,1515,1520,1525,1529,1534,1538,1543,1547,1551,1555,1560,1564,1568,1572,1576,1580],{"type":43,"tag":236,"props":1503,"children":1504},{"style":242},[1505],{"type":49,"value":1457},{"type":43,"tag":236,"props":1507,"children":1508},{"style":302},[1509],{"type":49,"value":1510}," state",{"type":43,"tag":236,"props":1512,"children":1513},{"style":254},[1514],{"type":49,"value":268},{"type":43,"tag":236,"props":1516,"children":1517},{"style":254},[1518],{"type":49,"value":1519}," \"",{"type":43,"tag":236,"props":1521,"children":1522},{"style":504},[1523],{"type":49,"value":1524},"closed",{"type":43,"tag":236,"props":1526,"children":1527},{"style":254},[1528],{"type":49,"value":501},{"type":43,"tag":236,"props":1530,"children":1531},{"style":254},[1532],{"type":49,"value":1533}," |",{"type":43,"tag":236,"props":1535,"children":1536},{"style":254},[1537],{"type":49,"value":1519},{"type":43,"tag":236,"props":1539,"children":1540},{"style":504},[1541],{"type":49,"value":1542},"open",{"type":43,"tag":236,"props":1544,"children":1545},{"style":254},[1546],{"type":49,"value":501},{"type":43,"tag":236,"props":1548,"children":1549},{"style":254},[1550],{"type":49,"value":1533},{"type":43,"tag":236,"props":1552,"children":1553},{"style":254},[1554],{"type":49,"value":1519},{"type":43,"tag":236,"props":1556,"children":1557},{"style":504},[1558],{"type":49,"value":1559},"half-open",{"type":43,"tag":236,"props":1561,"children":1562},{"style":254},[1563],{"type":49,"value":501},{"type":43,"tag":236,"props":1565,"children":1566},{"style":254},[1567],{"type":49,"value":875},{"type":43,"tag":236,"props":1569,"children":1570},{"style":254},[1571],{"type":49,"value":1519},{"type":43,"tag":236,"props":1573,"children":1574},{"style":504},[1575],{"type":49,"value":1524},{"type":43,"tag":236,"props":1577,"children":1578},{"style":254},[1579],{"type":49,"value":501},{"type":43,"tag":236,"props":1581,"children":1582},{"style":254},[1583],{"type":49,"value":421},{"type":43,"tag":236,"props":1585,"children":1586},{"class":238,"line":433},[1587],{"type":43,"tag":236,"props":1588,"children":1589},{"emptyLinePlaceholder":974},[1590],{"type":49,"value":977},{"type":43,"tag":236,"props":1592,"children":1593},{"class":238,"line":443},[1594,1599,1603,1608,1613,1617,1622,1626,1631,1636,1640,1645,1649],{"type":43,"tag":236,"props":1595,"children":1596},{"style":242},[1597],{"type":49,"value":1598},"  constructor",{"type":43,"tag":236,"props":1600,"children":1601},{"style":254},[1602],{"type":49,"value":257},{"type":43,"tag":236,"props":1604,"children":1605},{"style":242},[1606],{"type":49,"value":1607},"private",{"type":43,"tag":236,"props":1609,"children":1610},{"style":260},[1611],{"type":49,"value":1612}," threshold",{"type":43,"tag":236,"props":1614,"children":1615},{"style":254},[1616],{"type":49,"value":875},{"type":43,"tag":236,"props":1618,"children":1619},{"style":361},[1620],{"type":49,"value":1621}," 5",{"type":43,"tag":236,"props":1623,"children":1624},{"style":254},[1625],{"type":49,"value":938},{"type":43,"tag":236,"props":1627,"children":1628},{"style":242},[1629],{"type":49,"value":1630}," private",{"type":43,"tag":236,"props":1632,"children":1633},{"style":260},[1634],{"type":49,"value":1635}," resetMs",{"type":43,"tag":236,"props":1637,"children":1638},{"style":254},[1639],{"type":49,"value":875},{"type":43,"tag":236,"props":1641,"children":1642},{"style":361},[1643],{"type":49,"value":1644}," 30_000",{"type":43,"tag":236,"props":1646,"children":1647},{"style":254},[1648],{"type":49,"value":1265},{"type":43,"tag":236,"props":1650,"children":1651},{"style":254},[1652],{"type":49,"value":1653}," {}\n",{"type":43,"tag":236,"props":1655,"children":1656},{"class":238,"line":534},[1657],{"type":43,"tag":236,"props":1658,"children":1659},{"emptyLinePlaceholder":974},[1660],{"type":49,"value":977},{"type":43,"tag":236,"props":1662,"children":1663},{"class":238,"line":552},[1664,1669,1674,1678,1682,1687,1692,1696,1700,1704,1708,1712,1716,1721,1725,1729,1733,1737],{"type":43,"tag":236,"props":1665,"children":1666},{"style":242},[1667],{"type":49,"value":1668},"  async",{"type":43,"tag":236,"props":1670,"children":1671},{"style":302},[1672],{"type":49,"value":1673}," call",{"type":43,"tag":236,"props":1675,"children":1676},{"style":254},[1677],{"type":49,"value":765},{"type":43,"tag":236,"props":1679,"children":1680},{"style":271},[1681],{"type":49,"value":770},{"type":43,"tag":236,"props":1683,"children":1684},{"style":254},[1685],{"type":49,"value":1686},">(",{"type":43,"tag":236,"props":1688,"children":1689},{"style":248},[1690],{"type":49,"value":1691},"fn",{"type":43,"tag":236,"props":1693,"children":1694},{"style":254},[1695],{"type":49,"value":268},{"type":43,"tag":236,"props":1697,"children":1698},{"style":254},[1699],{"type":49,"value":792},{"type":43,"tag":236,"props":1701,"children":1702},{"style":242},[1703],{"type":49,"value":797},{"type":43,"tag":236,"props":1705,"children":1706},{"style":271},[1707],{"type":49,"value":802},{"type":43,"tag":236,"props":1709,"children":1710},{"style":254},[1711],{"type":49,"value":765},{"type":43,"tag":236,"props":1713,"children":1714},{"style":271},[1715],{"type":49,"value":770},{"type":43,"tag":236,"props":1717,"children":1718},{"style":254},[1719],{"type":49,"value":1720},">):",{"type":43,"tag":236,"props":1722,"children":1723},{"style":271},[1724],{"type":49,"value":802},{"type":43,"tag":236,"props":1726,"children":1727},{"style":254},[1728],{"type":49,"value":765},{"type":43,"tag":236,"props":1730,"children":1731},{"style":271},[1732],{"type":49,"value":770},{"type":43,"tag":236,"props":1734,"children":1735},{"style":254},[1736],{"type":49,"value":904},{"type":43,"tag":236,"props":1738,"children":1739},{"style":254},[1740],{"type":49,"value":289},{"type":43,"tag":236,"props":1742,"children":1743},{"class":238,"line":1061},[1744,1749,1753,1758,1763,1767,1771,1775,1779,1783],{"type":43,"tag":236,"props":1745,"children":1746},{"style":296},[1747],{"type":49,"value":1748},"    if",{"type":43,"tag":236,"props":1750,"children":1751},{"style":302},[1752],{"type":49,"value":305},{"type":43,"tag":236,"props":1754,"children":1755},{"style":254},[1756],{"type":49,"value":1757},"this.",{"type":43,"tag":236,"props":1759,"children":1760},{"style":308},[1761],{"type":49,"value":1762},"state",{"type":43,"tag":236,"props":1764,"children":1765},{"style":254},[1766],{"type":49,"value":386},{"type":43,"tag":236,"props":1768,"children":1769},{"style":254},[1770],{"type":49,"value":1519},{"type":43,"tag":236,"props":1772,"children":1773},{"style":504},[1774],{"type":49,"value":1542},{"type":43,"tag":236,"props":1776,"children":1777},{"style":254},[1778],{"type":49,"value":501},{"type":43,"tag":236,"props":1780,"children":1781},{"style":302},[1782],{"type":49,"value":325},{"type":43,"tag":236,"props":1784,"children":1785},{"style":254},[1786],{"type":49,"value":330},{"type":43,"tag":236,"props":1788,"children":1789},{"class":238,"line":1089},[1790,1794,1798,1803,1807,1812,1816,1821,1826,1831,1836,1840,1845,1849,1853,1857,1861,1865,1869,1873,1877],{"type":43,"tag":236,"props":1791,"children":1792},{"style":296},[1793],{"type":49,"value":1125},{"type":43,"tag":236,"props":1795,"children":1796},{"style":302},[1797],{"type":49,"value":305},{"type":43,"tag":236,"props":1799,"children":1800},{"style":308},[1801],{"type":49,"value":1802},"Date",{"type":43,"tag":236,"props":1804,"children":1805},{"style":254},[1806],{"type":49,"value":348},{"type":43,"tag":236,"props":1808,"children":1809},{"style":248},[1810],{"type":49,"value":1811},"now",{"type":43,"tag":236,"props":1813,"children":1814},{"style":302},[1815],{"type":49,"value":1227},{"type":43,"tag":236,"props":1817,"children":1818},{"style":254},[1819],{"type":49,"value":1820},"-",{"type":43,"tag":236,"props":1822,"children":1823},{"style":254},[1824],{"type":49,"value":1825}," this.",{"type":43,"tag":236,"props":1827,"children":1828},{"style":308},[1829],{"type":49,"value":1830},"lastFailure",{"type":43,"tag":236,"props":1832,"children":1833},{"style":254},[1834],{"type":49,"value":1835}," >",{"type":43,"tag":236,"props":1837,"children":1838},{"style":254},[1839],{"type":49,"value":1825},{"type":43,"tag":236,"props":1841,"children":1842},{"style":308},[1843],{"type":49,"value":1844},"resetMs",{"type":43,"tag":236,"props":1846,"children":1847},{"style":302},[1848],{"type":49,"value":325},{"type":43,"tag":236,"props":1850,"children":1851},{"style":254},[1852],{"type":49,"value":1757},{"type":43,"tag":236,"props":1854,"children":1855},{"style":308},[1856],{"type":49,"value":1762},{"type":43,"tag":236,"props":1858,"children":1859},{"style":254},[1860],{"type":49,"value":875},{"type":43,"tag":236,"props":1862,"children":1863},{"style":254},[1864],{"type":49,"value":1519},{"type":43,"tag":236,"props":1866,"children":1867},{"style":504},[1868],{"type":49,"value":1559},{"type":43,"tag":236,"props":1870,"children":1871},{"style":254},[1872],{"type":49,"value":501},{"type":43,"tag":236,"props":1874,"children":1875},{"style":254},[1876],{"type":49,"value":852},{"type":43,"tag":236,"props":1878,"children":1879},{"style":437},[1880],{"type":49,"value":1881}," \u002F\u002F allow one test\n",{"type":43,"tag":236,"props":1883,"children":1884},{"class":238,"line":1119},[1885,1890,1895,1899,1904,1908,1912],{"type":43,"tag":236,"props":1886,"children":1887},{"style":296},[1888],{"type":49,"value":1889},"      else",{"type":43,"tag":236,"props":1891,"children":1892},{"style":296},[1893],{"type":49,"value":1894}," throw",{"type":43,"tag":236,"props":1896,"children":1897},{"style":254},[1898],{"type":49,"value":1283},{"type":43,"tag":236,"props":1900,"children":1901},{"style":248},[1902],{"type":49,"value":1903}," CircuitBreakerOpenError",{"type":43,"tag":236,"props":1905,"children":1906},{"style":302},[1907],{"type":49,"value":1082},{"type":43,"tag":236,"props":1909,"children":1910},{"style":254},[1911],{"type":49,"value":852},{"type":43,"tag":236,"props":1913,"children":1914},{"style":437},[1915],{"type":49,"value":1916}," \u002F\u002F fail fast\n",{"type":43,"tag":236,"props":1918,"children":1919},{"class":238,"line":1184},[1920],{"type":43,"tag":236,"props":1921,"children":1922},{"style":254},[1923],{"type":49,"value":1347},{"type":43,"tag":236,"props":1925,"children":1926},{"class":238,"line":1193},[1927,1931],{"type":43,"tag":236,"props":1928,"children":1929},{"style":296},[1930],{"type":49,"value":1054},{"type":43,"tag":236,"props":1932,"children":1933},{"style":254},[1934],{"type":49,"value":289},{"type":43,"tag":236,"props":1936,"children":1937},{"class":238,"line":1272},[1938,1942,1947,1951,1955,1959,1963],{"type":43,"tag":236,"props":1939,"children":1940},{"style":242},[1941],{"type":49,"value":1199},{"type":43,"tag":236,"props":1943,"children":1944},{"style":308},[1945],{"type":49,"value":1946}," result",{"type":43,"tag":236,"props":1948,"children":1949},{"style":254},[1950],{"type":49,"value":875},{"type":43,"tag":236,"props":1952,"children":1953},{"style":296},[1954],{"type":49,"value":1072},{"type":43,"tag":236,"props":1956,"children":1957},{"style":248},[1958],{"type":49,"value":1077},{"type":43,"tag":236,"props":1960,"children":1961},{"style":302},[1962],{"type":49,"value":1082},{"type":43,"tag":236,"props":1964,"children":1965},{"style":254},[1966],{"type":49,"value":421},{"type":43,"tag":236,"props":1968,"children":1969},{"class":238,"line":1341},[1970,1975,1980,1984,1988],{"type":43,"tag":236,"props":1971,"children":1972},{"style":254},[1973],{"type":49,"value":1974},"      this.",{"type":43,"tag":236,"props":1976,"children":1977},{"style":308},[1978],{"type":49,"value":1979},"failures",{"type":43,"tag":236,"props":1981,"children":1982},{"style":254},[1983],{"type":49,"value":875},{"type":43,"tag":236,"props":1985,"children":1986},{"style":361},[1987],{"type":49,"value":1008},{"type":43,"tag":236,"props":1989,"children":1990},{"style":254},[1991],{"type":49,"value":421},{"type":43,"tag":236,"props":1993,"children":1994},{"class":238,"line":1350},[1995,1999,2003,2007,2011,2015,2019],{"type":43,"tag":236,"props":1996,"children":1997},{"style":254},[1998],{"type":49,"value":1974},{"type":43,"tag":236,"props":2000,"children":2001},{"style":308},[2002],{"type":49,"value":1762},{"type":43,"tag":236,"props":2004,"children":2005},{"style":254},[2006],{"type":49,"value":875},{"type":43,"tag":236,"props":2008,"children":2009},{"style":254},[2010],{"type":49,"value":1519},{"type":43,"tag":236,"props":2012,"children":2013},{"style":504},[2014],{"type":49,"value":1524},{"type":43,"tag":236,"props":2016,"children":2017},{"style":254},[2018],{"type":49,"value":501},{"type":43,"tag":236,"props":2020,"children":2021},{"style":254},[2022],{"type":49,"value":421},{"type":43,"tag":236,"props":2024,"children":2025},{"class":238,"line":1358},[2026,2030,2034],{"type":43,"tag":236,"props":2027,"children":2028},{"style":296},[2029],{"type":49,"value":1067},{"type":43,"tag":236,"props":2031,"children":2032},{"style":308},[2033],{"type":49,"value":1946},{"type":43,"tag":236,"props":2035,"children":2036},{"style":254},[2037],{"type":49,"value":421},{"type":43,"tag":236,"props":2039,"children":2040},{"class":238,"line":1401},[2041,2045,2049,2053,2058,2062],{"type":43,"tag":236,"props":2042,"children":2043},{"style":254},[2044],{"type":49,"value":1095},{"type":43,"tag":236,"props":2046,"children":2047},{"style":296},[2048],{"type":49,"value":1100},{"type":43,"tag":236,"props":2050,"children":2051},{"style":302},[2052],{"type":49,"value":305},{"type":43,"tag":236,"props":2054,"children":2055},{"style":308},[2056],{"type":49,"value":2057},"err",{"type":43,"tag":236,"props":2059,"children":2060},{"style":302},[2061],{"type":49,"value":325},{"type":43,"tag":236,"props":2063,"children":2064},{"style":254},[2065],{"type":49,"value":330},{"type":43,"tag":236,"props":2067,"children":2069},{"class":238,"line":2068},19,[2070,2074,2078],{"type":43,"tag":236,"props":2071,"children":2072},{"style":254},[2073],{"type":49,"value":1974},{"type":43,"tag":236,"props":2075,"children":2076},{"style":308},[2077],{"type":49,"value":1979},{"type":43,"tag":236,"props":2079,"children":2080},{"style":254},[2081],{"type":49,"value":2082},"++;\n",{"type":43,"tag":236,"props":2084,"children":2086},{"class":238,"line":2085},20,[2087,2091,2095,2099,2104,2108,2112,2116],{"type":43,"tag":236,"props":2088,"children":2089},{"style":254},[2090],{"type":49,"value":1974},{"type":43,"tag":236,"props":2092,"children":2093},{"style":308},[2094],{"type":49,"value":1830},{"type":43,"tag":236,"props":2096,"children":2097},{"style":254},[2098],{"type":49,"value":875},{"type":43,"tag":236,"props":2100,"children":2101},{"style":308},[2102],{"type":49,"value":2103}," Date",{"type":43,"tag":236,"props":2105,"children":2106},{"style":254},[2107],{"type":49,"value":348},{"type":43,"tag":236,"props":2109,"children":2110},{"style":248},[2111],{"type":49,"value":1811},{"type":43,"tag":236,"props":2113,"children":2114},{"style":302},[2115],{"type":49,"value":1082},{"type":43,"tag":236,"props":2117,"children":2118},{"style":254},[2119],{"type":49,"value":421},{"type":43,"tag":236,"props":2121,"children":2123},{"class":238,"line":2122},21,[2124,2128,2132,2136,2140,2144,2148,2153,2157,2161,2165,2169,2173,2177,2181],{"type":43,"tag":236,"props":2125,"children":2126},{"style":296},[2127],{"type":49,"value":1125},{"type":43,"tag":236,"props":2129,"children":2130},{"style":302},[2131],{"type":49,"value":305},{"type":43,"tag":236,"props":2133,"children":2134},{"style":254},[2135],{"type":49,"value":1757},{"type":43,"tag":236,"props":2137,"children":2138},{"style":308},[2139],{"type":49,"value":1979},{"type":43,"tag":236,"props":2141,"children":2142},{"style":254},[2143],{"type":49,"value":358},{"type":43,"tag":236,"props":2145,"children":2146},{"style":254},[2147],{"type":49,"value":1825},{"type":43,"tag":236,"props":2149,"children":2150},{"style":308},[2151],{"type":49,"value":2152},"threshold",{"type":43,"tag":236,"props":2154,"children":2155},{"style":302},[2156],{"type":49,"value":325},{"type":43,"tag":236,"props":2158,"children":2159},{"style":254},[2160],{"type":49,"value":1757},{"type":43,"tag":236,"props":2162,"children":2163},{"style":308},[2164],{"type":49,"value":1762},{"type":43,"tag":236,"props":2166,"children":2167},{"style":254},[2168],{"type":49,"value":875},{"type":43,"tag":236,"props":2170,"children":2171},{"style":254},[2172],{"type":49,"value":1519},{"type":43,"tag":236,"props":2174,"children":2175},{"style":504},[2176],{"type":49,"value":1542},{"type":43,"tag":236,"props":2178,"children":2179},{"style":254},[2180],{"type":49,"value":501},{"type":43,"tag":236,"props":2182,"children":2183},{"style":254},[2184],{"type":49,"value":421},{"type":43,"tag":236,"props":2186,"children":2188},{"class":238,"line":2187},22,[2189,2194,2199],{"type":43,"tag":236,"props":2190,"children":2191},{"style":296},[2192],{"type":49,"value":2193},"      throw",{"type":43,"tag":236,"props":2195,"children":2196},{"style":308},[2197],{"type":49,"value":2198}," err",{"type":43,"tag":236,"props":2200,"children":2201},{"style":254},[2202],{"type":49,"value":421},{"type":43,"tag":236,"props":2204,"children":2206},{"class":238,"line":2205},23,[2207],{"type":43,"tag":236,"props":2208,"children":2209},{"style":254},[2210],{"type":49,"value":1347},{"type":43,"tag":236,"props":2212,"children":2214},{"class":238,"line":2213},24,[2215],{"type":43,"tag":236,"props":2216,"children":2217},{"style":254},[2218],{"type":49,"value":430},{"type":43,"tag":236,"props":2220,"children":2222},{"class":238,"line":2221},25,[2223],{"type":43,"tag":236,"props":2224,"children":2225},{"style":254},[2226],{"type":49,"value":558},{"type":43,"tag":52,"props":2228,"children":2229},{},[2230,2232,2237],{"type":49,"value":2231},"When open, requests fail immediately instead of waiting for a timeout, giving the downstream service time to recover. After ",{"type":43,"tag":83,"props":2233,"children":2235},{"className":2234},[],[2236],{"type":49,"value":1844},{"type":49,"value":2238},", one test request is allowed through; if it succeeds the circuit closes and traffic resumes.",{"type":43,"tag":220,"props":2240,"children":2242},{"id":2241},"retry-budget-system-level-protection",[2243],{"type":49,"value":2244},"Retry budget (system-level protection)",{"type":43,"tag":52,"props":2246,"children":2247},{},[2248],{"type":49,"value":2249},"Limit retries as a percentage of total traffic, not per-request.",{"type":43,"tag":76,"props":2251,"children":2253},{"className":228,"code":2252,"language":230,"meta":85,"style":85},"class RetryBudget {\n  private requests = 0;\n  private retries = 0;\n\n  constructor(private maxRetryRatio = 0.1, private minRetriesPerWindow = 10) {\n    setInterval(() => { this.requests = 0; this.retries = 0; }, 1000); \u002F\u002F sliding window\n  }\n\n  recordRequest() { this.requests++; }\n  recordRetry() { this.retries++; }\n\n  shouldRetry(): boolean {\n    if (this.retries \u003C this.minRetriesPerWindow) return true; \u002F\u002F always allow some\n    return this.retries \u002F Math.max(this.requests, 1) \u003C this.maxRetryRatio;\n  }\n}\n",[2254],{"type":43,"tag":83,"props":2255,"children":2256},{"__ignoreMap":85},[2257,2273,2297,2321,2328,2387,2476,2483,2490,2524,2556,2563,2584,2638,2713,2720],{"type":43,"tag":236,"props":2258,"children":2259},{"class":238,"line":30},[2260,2264,2269],{"type":43,"tag":236,"props":2261,"children":2262},{"style":242},[2263],{"type":49,"value":1440},{"type":43,"tag":236,"props":2265,"children":2266},{"style":271},[2267],{"type":49,"value":2268}," RetryBudget",{"type":43,"tag":236,"props":2270,"children":2271},{"style":254},[2272],{"type":49,"value":289},{"type":43,"tag":236,"props":2274,"children":2275},{"class":238,"line":292},[2276,2280,2285,2289,2293],{"type":43,"tag":236,"props":2277,"children":2278},{"style":242},[2279],{"type":49,"value":1457},{"type":43,"tag":236,"props":2281,"children":2282},{"style":302},[2283],{"type":49,"value":2284}," requests",{"type":43,"tag":236,"props":2286,"children":2287},{"style":254},[2288],{"type":49,"value":875},{"type":43,"tag":236,"props":2290,"children":2291},{"style":361},[2292],{"type":49,"value":1008},{"type":43,"tag":236,"props":2294,"children":2295},{"style":254},[2296],{"type":49,"value":421},{"type":43,"tag":236,"props":2298,"children":2299},{"class":238,"line":26},[2300,2304,2309,2313,2317],{"type":43,"tag":236,"props":2301,"children":2302},{"style":242},[2303],{"type":49,"value":1457},{"type":43,"tag":236,"props":2305,"children":2306},{"style":302},[2307],{"type":49,"value":2308}," retries",{"type":43,"tag":236,"props":2310,"children":2311},{"style":254},[2312],{"type":49,"value":875},{"type":43,"tag":236,"props":2314,"children":2315},{"style":361},[2316],{"type":49,"value":1008},{"type":43,"tag":236,"props":2318,"children":2319},{"style":254},[2320],{"type":49,"value":421},{"type":43,"tag":236,"props":2322,"children":2323},{"class":238,"line":424},[2324],{"type":43,"tag":236,"props":2325,"children":2326},{"emptyLinePlaceholder":974},[2327],{"type":49,"value":977},{"type":43,"tag":236,"props":2329,"children":2330},{"class":238,"line":433},[2331,2335,2339,2343,2348,2352,2357,2361,2365,2370,2374,2379,2383],{"type":43,"tag":236,"props":2332,"children":2333},{"style":242},[2334],{"type":49,"value":1598},{"type":43,"tag":236,"props":2336,"children":2337},{"style":254},[2338],{"type":49,"value":257},{"type":43,"tag":236,"props":2340,"children":2341},{"style":242},[2342],{"type":49,"value":1607},{"type":43,"tag":236,"props":2344,"children":2345},{"style":260},[2346],{"type":49,"value":2347}," maxRetryRatio",{"type":43,"tag":236,"props":2349,"children":2350},{"style":254},[2351],{"type":49,"value":875},{"type":43,"tag":236,"props":2353,"children":2354},{"style":361},[2355],{"type":49,"value":2356}," 0.1",{"type":43,"tag":236,"props":2358,"children":2359},{"style":254},[2360],{"type":49,"value":938},{"type":43,"tag":236,"props":2362,"children":2363},{"style":242},[2364],{"type":49,"value":1630},{"type":43,"tag":236,"props":2366,"children":2367},{"style":260},[2368],{"type":49,"value":2369}," minRetriesPerWindow",{"type":43,"tag":236,"props":2371,"children":2372},{"style":254},[2373],{"type":49,"value":875},{"type":43,"tag":236,"props":2375,"children":2376},{"style":361},[2377],{"type":49,"value":2378}," 10",{"type":43,"tag":236,"props":2380,"children":2381},{"style":254},[2382],{"type":49,"value":1265},{"type":43,"tag":236,"props":2384,"children":2385},{"style":254},[2386],{"type":49,"value":289},{"type":43,"tag":236,"props":2388,"children":2389},{"class":238,"line":443},[2390,2395,2399,2403,2407,2411,2415,2420,2424,2428,2432,2436,2441,2445,2449,2453,2458,2463,2467,2471],{"type":43,"tag":236,"props":2391,"children":2392},{"style":248},[2393],{"type":49,"value":2394},"    setInterval",{"type":43,"tag":236,"props":2396,"children":2397},{"style":302},[2398],{"type":49,"value":257},{"type":43,"tag":236,"props":2400,"children":2401},{"style":254},[2402],{"type":49,"value":1082},{"type":43,"tag":236,"props":2404,"children":2405},{"style":242},[2406],{"type":49,"value":797},{"type":43,"tag":236,"props":2408,"children":2409},{"style":254},[2410],{"type":49,"value":832},{"type":43,"tag":236,"props":2412,"children":2413},{"style":254},[2414],{"type":49,"value":1825},{"type":43,"tag":236,"props":2416,"children":2417},{"style":308},[2418],{"type":49,"value":2419},"requests",{"type":43,"tag":236,"props":2421,"children":2422},{"style":254},[2423],{"type":49,"value":875},{"type":43,"tag":236,"props":2425,"children":2426},{"style":361},[2427],{"type":49,"value":1008},{"type":43,"tag":236,"props":2429,"children":2430},{"style":254},[2431],{"type":49,"value":852},{"type":43,"tag":236,"props":2433,"children":2434},{"style":254},[2435],{"type":49,"value":1825},{"type":43,"tag":236,"props":2437,"children":2438},{"style":308},[2439],{"type":49,"value":2440},"retries",{"type":43,"tag":236,"props":2442,"children":2443},{"style":254},[2444],{"type":49,"value":875},{"type":43,"tag":236,"props":2446,"children":2447},{"style":361},[2448],{"type":49,"value":1008},{"type":43,"tag":236,"props":2450,"children":2451},{"style":254},[2452],{"type":49,"value":852},{"type":43,"tag":236,"props":2454,"children":2455},{"style":254},[2456],{"type":49,"value":2457}," },",{"type":43,"tag":236,"props":2459,"children":2460},{"style":361},[2461],{"type":49,"value":2462}," 1000",{"type":43,"tag":236,"props":2464,"children":2465},{"style":302},[2466],{"type":49,"value":1265},{"type":43,"tag":236,"props":2468,"children":2469},{"style":254},[2470],{"type":49,"value":852},{"type":43,"tag":236,"props":2472,"children":2473},{"style":437},[2474],{"type":49,"value":2475}," \u002F\u002F sliding window\n",{"type":43,"tag":236,"props":2477,"children":2478},{"class":238,"line":534},[2479],{"type":43,"tag":236,"props":2480,"children":2481},{"style":254},[2482],{"type":49,"value":430},{"type":43,"tag":236,"props":2484,"children":2485},{"class":238,"line":552},[2486],{"type":43,"tag":236,"props":2487,"children":2488},{"emptyLinePlaceholder":974},[2489],{"type":49,"value":977},{"type":43,"tag":236,"props":2491,"children":2492},{"class":238,"line":1061},[2493,2498,2502,2506,2510,2514,2519],{"type":43,"tag":236,"props":2494,"children":2495},{"style":302},[2496],{"type":49,"value":2497},"  recordRequest",{"type":43,"tag":236,"props":2499,"children":2500},{"style":254},[2501],{"type":49,"value":1082},{"type":43,"tag":236,"props":2503,"children":2504},{"style":254},[2505],{"type":49,"value":832},{"type":43,"tag":236,"props":2507,"children":2508},{"style":254},[2509],{"type":49,"value":1825},{"type":43,"tag":236,"props":2511,"children":2512},{"style":308},[2513],{"type":49,"value":2419},{"type":43,"tag":236,"props":2515,"children":2516},{"style":254},[2517],{"type":49,"value":2518},"++;",{"type":43,"tag":236,"props":2520,"children":2521},{"style":254},[2522],{"type":49,"value":2523}," }\n",{"type":43,"tag":236,"props":2525,"children":2526},{"class":238,"line":1089},[2527,2532,2536,2540,2544,2548,2552],{"type":43,"tag":236,"props":2528,"children":2529},{"style":302},[2530],{"type":49,"value":2531},"  recordRetry",{"type":43,"tag":236,"props":2533,"children":2534},{"style":254},[2535],{"type":49,"value":1082},{"type":43,"tag":236,"props":2537,"children":2538},{"style":254},[2539],{"type":49,"value":832},{"type":43,"tag":236,"props":2541,"children":2542},{"style":254},[2543],{"type":49,"value":1825},{"type":43,"tag":236,"props":2545,"children":2546},{"style":308},[2547],{"type":49,"value":2440},{"type":43,"tag":236,"props":2549,"children":2550},{"style":254},[2551],{"type":49,"value":2518},{"type":43,"tag":236,"props":2553,"children":2554},{"style":254},[2555],{"type":49,"value":2523},{"type":43,"tag":236,"props":2557,"children":2558},{"class":238,"line":1119},[2559],{"type":43,"tag":236,"props":2560,"children":2561},{"emptyLinePlaceholder":974},[2562],{"type":49,"value":977},{"type":43,"tag":236,"props":2564,"children":2565},{"class":238,"line":1184},[2566,2571,2576,2580],{"type":43,"tag":236,"props":2567,"children":2568},{"style":302},[2569],{"type":49,"value":2570},"  shouldRetry",{"type":43,"tag":236,"props":2572,"children":2573},{"style":254},[2574],{"type":49,"value":2575},"():",{"type":43,"tag":236,"props":2577,"children":2578},{"style":271},[2579],{"type":49,"value":284},{"type":43,"tag":236,"props":2581,"children":2582},{"style":254},[2583],{"type":49,"value":289},{"type":43,"tag":236,"props":2585,"children":2586},{"class":238,"line":1193},[2587,2591,2595,2599,2603,2608,2612,2617,2621,2625,2629,2633],{"type":43,"tag":236,"props":2588,"children":2589},{"style":296},[2590],{"type":49,"value":1748},{"type":43,"tag":236,"props":2592,"children":2593},{"style":302},[2594],{"type":49,"value":305},{"type":43,"tag":236,"props":2596,"children":2597},{"style":254},[2598],{"type":49,"value":1757},{"type":43,"tag":236,"props":2600,"children":2601},{"style":308},[2602],{"type":49,"value":2440},{"type":43,"tag":236,"props":2604,"children":2605},{"style":254},[2606],{"type":49,"value":2607}," \u003C",{"type":43,"tag":236,"props":2609,"children":2610},{"style":254},[2611],{"type":49,"value":1825},{"type":43,"tag":236,"props":2613,"children":2614},{"style":308},[2615],{"type":49,"value":2616},"minRetriesPerWindow",{"type":43,"tag":236,"props":2618,"children":2619},{"style":302},[2620],{"type":49,"value":325},{"type":43,"tag":236,"props":2622,"children":2623},{"style":296},[2624],{"type":49,"value":521},{"type":43,"tag":236,"props":2626,"children":2627},{"style":524},[2628],{"type":49,"value":527},{"type":43,"tag":236,"props":2630,"children":2631},{"style":254},[2632],{"type":49,"value":852},{"type":43,"tag":236,"props":2634,"children":2635},{"style":437},[2636],{"type":49,"value":2637}," \u002F\u002F always allow some\n",{"type":43,"tag":236,"props":2639,"children":2640},{"class":238,"line":1272},[2641,2645,2649,2653,2658,2662,2666,2671,2675,2679,2683,2687,2692,2696,2700,2704,2709],{"type":43,"tag":236,"props":2642,"children":2643},{"style":296},[2644],{"type":49,"value":338},{"type":43,"tag":236,"props":2646,"children":2647},{"style":254},[2648],{"type":49,"value":1825},{"type":43,"tag":236,"props":2650,"children":2651},{"style":308},[2652],{"type":49,"value":2440},{"type":43,"tag":236,"props":2654,"children":2655},{"style":254},[2656],{"type":49,"value":2657}," \u002F",{"type":43,"tag":236,"props":2659,"children":2660},{"style":308},[2661],{"type":49,"value":1213},{"type":43,"tag":236,"props":2663,"children":2664},{"style":254},[2665],{"type":49,"value":348},{"type":43,"tag":236,"props":2667,"children":2668},{"style":248},[2669],{"type":49,"value":2670},"max",{"type":43,"tag":236,"props":2672,"children":2673},{"style":302},[2674],{"type":49,"value":257},{"type":43,"tag":236,"props":2676,"children":2677},{"style":254},[2678],{"type":49,"value":1757},{"type":43,"tag":236,"props":2680,"children":2681},{"style":308},[2682],{"type":49,"value":2419},{"type":43,"tag":236,"props":2684,"children":2685},{"style":254},[2686],{"type":49,"value":938},{"type":43,"tag":236,"props":2688,"children":2689},{"style":361},[2690],{"type":49,"value":2691}," 1",{"type":43,"tag":236,"props":2693,"children":2694},{"style":302},[2695],{"type":49,"value":325},{"type":43,"tag":236,"props":2697,"children":2698},{"style":254},[2699],{"type":49,"value":765},{"type":43,"tag":236,"props":2701,"children":2702},{"style":254},[2703],{"type":49,"value":1825},{"type":43,"tag":236,"props":2705,"children":2706},{"style":308},[2707],{"type":49,"value":2708},"maxRetryRatio",{"type":43,"tag":236,"props":2710,"children":2711},{"style":254},[2712],{"type":49,"value":421},{"type":43,"tag":236,"props":2714,"children":2715},{"class":238,"line":1341},[2716],{"type":43,"tag":236,"props":2717,"children":2718},{"style":254},[2719],{"type":49,"value":430},{"type":43,"tag":236,"props":2721,"children":2722},{"class":238,"line":1350},[2723],{"type":43,"tag":236,"props":2724,"children":2725},{"style":254},[2726],{"type":49,"value":558},{"type":43,"tag":52,"props":2728,"children":2729},{},[2730],{"type":49,"value":2731},"With a 10% budget at 1,000 req\u002Fs, at most 100 are retries -- the system can never generate more than 1.1x its normal load from retries. This is the approach used by Google's gRPC and the Google SRE book.",{"type":43,"tag":220,"props":2733,"children":2735},{"id":2734},"deadline-propagation",[2736],{"type":49,"value":2737},"Deadline propagation",{"type":43,"tag":52,"props":2739,"children":2740},{},[2741],{"type":49,"value":2742},"Pass the remaining time budget through the call chain; don't give each retry a fresh timeout.",{"type":43,"tag":76,"props":2744,"children":2746},{"className":228,"code":2745,"language":230,"meta":85,"style":85},"async function handleRequest(req: Request) {\n  const deadline = Date.now() + 10_000; \u002F\u002F 10s total budget\n  const resultA = await callWithDeadline(serviceA.fetch, deadline);\n  const resultB = await callWithDeadline(serviceB.fetch, deadline); \u002F\u002F if A took 8s, B gets 2s\n  return combine(resultA, resultB);\n}\n\nasync function callWithDeadline\u003CT>(\n  fn: (timeoutMs: number) => Promise\u003CT>,\n  deadline: number,\n): Promise\u003CT> {\n  const remaining = deadline - Date.now();\n  if (remaining \u003C= 0) throw new DeadlineExceededError();\n  return fn(remaining);\n}\n",[2747],{"type":43,"tag":83,"props":2748,"children":2749},{"__ignoreMap":85},[2750,2792,2843,2901,2963,3000,3007,3014,3041,3093,3114,3141,3186,3235,3262],{"type":43,"tag":236,"props":2751,"children":2752},{"class":238,"line":30},[2753,2757,2761,2766,2770,2775,2779,2784,2788],{"type":43,"tag":236,"props":2754,"children":2755},{"style":242},[2756],{"type":49,"value":750},{"type":43,"tag":236,"props":2758,"children":2759},{"style":242},[2760],{"type":49,"value":755},{"type":43,"tag":236,"props":2762,"children":2763},{"style":248},[2764],{"type":49,"value":2765}," handleRequest",{"type":43,"tag":236,"props":2767,"children":2768},{"style":254},[2769],{"type":49,"value":257},{"type":43,"tag":236,"props":2771,"children":2772},{"style":260},[2773],{"type":49,"value":2774},"req",{"type":43,"tag":236,"props":2776,"children":2777},{"style":254},[2778],{"type":49,"value":268},{"type":43,"tag":236,"props":2780,"children":2781},{"style":271},[2782],{"type":49,"value":2783}," Request",{"type":43,"tag":236,"props":2785,"children":2786},{"style":254},[2787],{"type":49,"value":1265},{"type":43,"tag":236,"props":2789,"children":2790},{"style":254},[2791],{"type":49,"value":289},{"type":43,"tag":236,"props":2793,"children":2794},{"class":238,"line":292},[2795,2799,2804,2808,2812,2816,2820,2824,2829,2834,2838],{"type":43,"tag":236,"props":2796,"children":2797},{"style":242},[2798],{"type":49,"value":916},{"type":43,"tag":236,"props":2800,"children":2801},{"style":308},[2802],{"type":49,"value":2803}," deadline",{"type":43,"tag":236,"props":2805,"children":2806},{"style":254},[2807],{"type":49,"value":875},{"type":43,"tag":236,"props":2809,"children":2810},{"style":308},[2811],{"type":49,"value":2103},{"type":43,"tag":236,"props":2813,"children":2814},{"style":254},[2815],{"type":49,"value":348},{"type":43,"tag":236,"props":2817,"children":2818},{"style":248},[2819],{"type":49,"value":1811},{"type":43,"tag":236,"props":2821,"children":2822},{"style":302},[2823],{"type":49,"value":1227},{"type":43,"tag":236,"props":2825,"children":2826},{"style":254},[2827],{"type":49,"value":2828},"+",{"type":43,"tag":236,"props":2830,"children":2831},{"style":361},[2832],{"type":49,"value":2833}," 10_000",{"type":43,"tag":236,"props":2835,"children":2836},{"style":254},[2837],{"type":49,"value":852},{"type":43,"tag":236,"props":2839,"children":2840},{"style":437},[2841],{"type":49,"value":2842}," \u002F\u002F 10s total budget\n",{"type":43,"tag":236,"props":2844,"children":2845},{"class":238,"line":26},[2846,2850,2855,2859,2863,2868,2872,2877,2881,2885,2889,2893,2897],{"type":43,"tag":236,"props":2847,"children":2848},{"style":242},[2849],{"type":49,"value":916},{"type":43,"tag":236,"props":2851,"children":2852},{"style":308},[2853],{"type":49,"value":2854}," resultA",{"type":43,"tag":236,"props":2856,"children":2857},{"style":254},[2858],{"type":49,"value":875},{"type":43,"tag":236,"props":2860,"children":2861},{"style":296},[2862],{"type":49,"value":1072},{"type":43,"tag":236,"props":2864,"children":2865},{"style":248},[2866],{"type":49,"value":2867}," callWithDeadline",{"type":43,"tag":236,"props":2869,"children":2870},{"style":302},[2871],{"type":49,"value":257},{"type":43,"tag":236,"props":2873,"children":2874},{"style":308},[2875],{"type":49,"value":2876},"serviceA",{"type":43,"tag":236,"props":2878,"children":2879},{"style":254},[2880],{"type":49,"value":348},{"type":43,"tag":236,"props":2882,"children":2883},{"style":308},[2884],{"type":49,"value":507},{"type":43,"tag":236,"props":2886,"children":2887},{"style":254},[2888],{"type":49,"value":938},{"type":43,"tag":236,"props":2890,"children":2891},{"style":308},[2892],{"type":49,"value":2803},{"type":43,"tag":236,"props":2894,"children":2895},{"style":302},[2896],{"type":49,"value":1265},{"type":43,"tag":236,"props":2898,"children":2899},{"style":254},[2900],{"type":49,"value":421},{"type":43,"tag":236,"props":2902,"children":2903},{"class":238,"line":424},[2904,2908,2913,2917,2921,2925,2929,2934,2938,2942,2946,2950,2954,2958],{"type":43,"tag":236,"props":2905,"children":2906},{"style":242},[2907],{"type":49,"value":916},{"type":43,"tag":236,"props":2909,"children":2910},{"style":308},[2911],{"type":49,"value":2912}," resultB",{"type":43,"tag":236,"props":2914,"children":2915},{"style":254},[2916],{"type":49,"value":875},{"type":43,"tag":236,"props":2918,"children":2919},{"style":296},[2920],{"type":49,"value":1072},{"type":43,"tag":236,"props":2922,"children":2923},{"style":248},[2924],{"type":49,"value":2867},{"type":43,"tag":236,"props":2926,"children":2927},{"style":302},[2928],{"type":49,"value":257},{"type":43,"tag":236,"props":2930,"children":2931},{"style":308},[2932],{"type":49,"value":2933},"serviceB",{"type":43,"tag":236,"props":2935,"children":2936},{"style":254},[2937],{"type":49,"value":348},{"type":43,"tag":236,"props":2939,"children":2940},{"style":308},[2941],{"type":49,"value":507},{"type":43,"tag":236,"props":2943,"children":2944},{"style":254},[2945],{"type":49,"value":938},{"type":43,"tag":236,"props":2947,"children":2948},{"style":308},[2949],{"type":49,"value":2803},{"type":43,"tag":236,"props":2951,"children":2952},{"style":302},[2953],{"type":49,"value":1265},{"type":43,"tag":236,"props":2955,"children":2956},{"style":254},[2957],{"type":49,"value":852},{"type":43,"tag":236,"props":2959,"children":2960},{"style":437},[2961],{"type":49,"value":2962}," \u002F\u002F if A took 8s, B gets 2s\n",{"type":43,"tag":236,"props":2964,"children":2965},{"class":238,"line":433},[2966,2970,2975,2979,2984,2988,2992,2996],{"type":43,"tag":236,"props":2967,"children":2968},{"style":296},[2969],{"type":49,"value":540},{"type":43,"tag":236,"props":2971,"children":2972},{"style":248},[2973],{"type":49,"value":2974}," combine",{"type":43,"tag":236,"props":2976,"children":2977},{"style":302},[2978],{"type":49,"value":257},{"type":43,"tag":236,"props":2980,"children":2981},{"style":308},[2982],{"type":49,"value":2983},"resultA",{"type":43,"tag":236,"props":2985,"children":2986},{"style":254},[2987],{"type":49,"value":938},{"type":43,"tag":236,"props":2989,"children":2990},{"style":308},[2991],{"type":49,"value":2912},{"type":43,"tag":236,"props":2993,"children":2994},{"style":302},[2995],{"type":49,"value":1265},{"type":43,"tag":236,"props":2997,"children":2998},{"style":254},[2999],{"type":49,"value":421},{"type":43,"tag":236,"props":3001,"children":3002},{"class":238,"line":443},[3003],{"type":43,"tag":236,"props":3004,"children":3005},{"style":254},[3006],{"type":49,"value":558},{"type":43,"tag":236,"props":3008,"children":3009},{"class":238,"line":534},[3010],{"type":43,"tag":236,"props":3011,"children":3012},{"emptyLinePlaceholder":974},[3013],{"type":49,"value":977},{"type":43,"tag":236,"props":3015,"children":3016},{"class":238,"line":552},[3017,3021,3025,3029,3033,3037],{"type":43,"tag":236,"props":3018,"children":3019},{"style":242},[3020],{"type":49,"value":750},{"type":43,"tag":236,"props":3022,"children":3023},{"style":242},[3024],{"type":49,"value":755},{"type":43,"tag":236,"props":3026,"children":3027},{"style":248},[3028],{"type":49,"value":2867},{"type":43,"tag":236,"props":3030,"children":3031},{"style":254},[3032],{"type":49,"value":765},{"type":43,"tag":236,"props":3034,"children":3035},{"style":271},[3036],{"type":49,"value":770},{"type":43,"tag":236,"props":3038,"children":3039},{"style":254},[3040],{"type":49,"value":775},{"type":43,"tag":236,"props":3042,"children":3043},{"class":238,"line":1061},[3044,3048,3052,3056,3061,3065,3069,3073,3077,3081,3085,3089],{"type":43,"tag":236,"props":3045,"children":3046},{"style":248},[3047],{"type":49,"value":783},{"type":43,"tag":236,"props":3049,"children":3050},{"style":254},[3051],{"type":49,"value":268},{"type":43,"tag":236,"props":3053,"children":3054},{"style":254},[3055],{"type":49,"value":305},{"type":43,"tag":236,"props":3057,"children":3058},{"style":260},[3059],{"type":49,"value":3060},"timeoutMs",{"type":43,"tag":236,"props":3062,"children":3063},{"style":254},[3064],{"type":49,"value":268},{"type":43,"tag":236,"props":3066,"children":3067},{"style":271},[3068],{"type":49,"value":847},{"type":43,"tag":236,"props":3070,"children":3071},{"style":254},[3072],{"type":49,"value":1265},{"type":43,"tag":236,"props":3074,"children":3075},{"style":242},[3076],{"type":49,"value":797},{"type":43,"tag":236,"props":3078,"children":3079},{"style":271},[3080],{"type":49,"value":802},{"type":43,"tag":236,"props":3082,"children":3083},{"style":254},[3084],{"type":49,"value":765},{"type":43,"tag":236,"props":3086,"children":3087},{"style":271},[3088],{"type":49,"value":770},{"type":43,"tag":236,"props":3090,"children":3091},{"style":254},[3092],{"type":49,"value":815},{"type":43,"tag":236,"props":3094,"children":3095},{"class":238,"line":1089},[3096,3101,3105,3109],{"type":43,"tag":236,"props":3097,"children":3098},{"style":260},[3099],{"type":49,"value":3100},"  deadline",{"type":43,"tag":236,"props":3102,"children":3103},{"style":254},[3104],{"type":49,"value":268},{"type":43,"tag":236,"props":3106,"children":3107},{"style":271},[3108],{"type":49,"value":847},{"type":43,"tag":236,"props":3110,"children":3111},{"style":254},[3112],{"type":49,"value":3113},",\n",{"type":43,"tag":236,"props":3115,"children":3116},{"class":238,"line":1119},[3117,3121,3125,3129,3133,3137],{"type":43,"tag":236,"props":3118,"children":3119},{"style":254},[3120],{"type":49,"value":279},{"type":43,"tag":236,"props":3122,"children":3123},{"style":271},[3124],{"type":49,"value":802},{"type":43,"tag":236,"props":3126,"children":3127},{"style":254},[3128],{"type":49,"value":765},{"type":43,"tag":236,"props":3130,"children":3131},{"style":271},[3132],{"type":49,"value":770},{"type":43,"tag":236,"props":3134,"children":3135},{"style":254},[3136],{"type":49,"value":904},{"type":43,"tag":236,"props":3138,"children":3139},{"style":254},[3140],{"type":49,"value":289},{"type":43,"tag":236,"props":3142,"children":3143},{"class":238,"line":1184},[3144,3148,3153,3157,3161,3166,3170,3174,3178,3182],{"type":43,"tag":236,"props":3145,"children":3146},{"style":242},[3147],{"type":49,"value":916},{"type":43,"tag":236,"props":3149,"children":3150},{"style":308},[3151],{"type":49,"value":3152}," remaining",{"type":43,"tag":236,"props":3154,"children":3155},{"style":254},[3156],{"type":49,"value":875},{"type":43,"tag":236,"props":3158,"children":3159},{"style":308},[3160],{"type":49,"value":2803},{"type":43,"tag":236,"props":3162,"children":3163},{"style":254},[3164],{"type":49,"value":3165}," -",{"type":43,"tag":236,"props":3167,"children":3168},{"style":308},[3169],{"type":49,"value":2103},{"type":43,"tag":236,"props":3171,"children":3172},{"style":254},[3173],{"type":49,"value":348},{"type":43,"tag":236,"props":3175,"children":3176},{"style":248},[3177],{"type":49,"value":1811},{"type":43,"tag":236,"props":3179,"children":3180},{"style":302},[3181],{"type":49,"value":1082},{"type":43,"tag":236,"props":3183,"children":3184},{"style":254},[3185],{"type":49,"value":421},{"type":43,"tag":236,"props":3187,"children":3188},{"class":238,"line":1193},[3189,3193,3197,3202,3206,3210,3214,3218,3222,3227,3231],{"type":43,"tag":236,"props":3190,"children":3191},{"style":296},[3192],{"type":49,"value":299},{"type":43,"tag":236,"props":3194,"children":3195},{"style":302},[3196],{"type":49,"value":305},{"type":43,"tag":236,"props":3198,"children":3199},{"style":308},[3200],{"type":49,"value":3201},"remaining",{"type":43,"tag":236,"props":3203,"children":3204},{"style":254},[3205],{"type":49,"value":1021},{"type":43,"tag":236,"props":3207,"children":3208},{"style":361},[3209],{"type":49,"value":1008},{"type":43,"tag":236,"props":3211,"children":3212},{"style":302},[3213],{"type":49,"value":325},{"type":43,"tag":236,"props":3215,"children":3216},{"style":296},[3217],{"type":49,"value":1173},{"type":43,"tag":236,"props":3219,"children":3220},{"style":254},[3221],{"type":49,"value":1283},{"type":43,"tag":236,"props":3223,"children":3224},{"style":248},[3225],{"type":49,"value":3226}," DeadlineExceededError",{"type":43,"tag":236,"props":3228,"children":3229},{"style":302},[3230],{"type":49,"value":1082},{"type":43,"tag":236,"props":3232,"children":3233},{"style":254},[3234],{"type":49,"value":421},{"type":43,"tag":236,"props":3236,"children":3237},{"class":238,"line":1272},[3238,3242,3246,3250,3254,3258],{"type":43,"tag":236,"props":3239,"children":3240},{"style":296},[3241],{"type":49,"value":540},{"type":43,"tag":236,"props":3243,"children":3244},{"style":248},[3245],{"type":49,"value":1077},{"type":43,"tag":236,"props":3247,"children":3248},{"style":302},[3249],{"type":49,"value":257},{"type":43,"tag":236,"props":3251,"children":3252},{"style":308},[3253],{"type":49,"value":3201},{"type":43,"tag":236,"props":3255,"children":3256},{"style":302},[3257],{"type":49,"value":1265},{"type":43,"tag":236,"props":3259,"children":3260},{"style":254},[3261],{"type":49,"value":421},{"type":43,"tag":236,"props":3263,"children":3264},{"class":238,"line":1341},[3265],{"type":43,"tag":236,"props":3266,"children":3267},{"style":254},[3268],{"type":49,"value":558},{"type":43,"tag":52,"props":3270,"children":3271},{},[3272],{"type":49,"value":3273},"Without propagation, a retry starting 8s into a 10s budget gets a fresh 10s timeout and the user waits 18s total. With it, the retry gets 2s and fails fast.",{"type":43,"tag":220,"props":3275,"children":3277},{"id":3276},"load-shedding-server-side-protection",[3278],{"type":49,"value":3279},"Load shedding (server-side protection)",{"type":43,"tag":52,"props":3281,"children":3282},{},[3283],{"type":49,"value":3284},"The server rejects requests when overloaded instead of accepting them and being slow.",{"type":43,"tag":76,"props":3286,"children":3288},{"className":228,"code":3287,"language":230,"meta":85,"style":85},"class LoadShedder {\n  private active = 0;\n  constructor(private maxConcurrent: number) {}\n\n  async handle\u003CT>(fn: () => Promise\u003CT>): Promise\u003CT> {\n    if (this.active >= this.maxConcurrent) throw new HttpError(503, \"Service overloaded\");\n    this.active++;\n    try { return await fn(); }\n    finally { this.active--; }\n  }\n}\n",[3289],{"type":43,"tag":83,"props":3290,"children":3291},{"__ignoreMap":85},[3292,3308,3332,3368,3375,3451,3534,3550,3586,3615,3622],{"type":43,"tag":236,"props":3293,"children":3294},{"class":238,"line":30},[3295,3299,3304],{"type":43,"tag":236,"props":3296,"children":3297},{"style":242},[3298],{"type":49,"value":1440},{"type":43,"tag":236,"props":3300,"children":3301},{"style":271},[3302],{"type":49,"value":3303}," LoadShedder",{"type":43,"tag":236,"props":3305,"children":3306},{"style":254},[3307],{"type":49,"value":289},{"type":43,"tag":236,"props":3309,"children":3310},{"class":238,"line":292},[3311,3315,3320,3324,3328],{"type":43,"tag":236,"props":3312,"children":3313},{"style":242},[3314],{"type":49,"value":1457},{"type":43,"tag":236,"props":3316,"children":3317},{"style":302},[3318],{"type":49,"value":3319}," active",{"type":43,"tag":236,"props":3321,"children":3322},{"style":254},[3323],{"type":49,"value":875},{"type":43,"tag":236,"props":3325,"children":3326},{"style":361},[3327],{"type":49,"value":1008},{"type":43,"tag":236,"props":3329,"children":3330},{"style":254},[3331],{"type":49,"value":421},{"type":43,"tag":236,"props":3333,"children":3334},{"class":238,"line":26},[3335,3339,3343,3347,3352,3356,3360,3364],{"type":43,"tag":236,"props":3336,"children":3337},{"style":242},[3338],{"type":49,"value":1598},{"type":43,"tag":236,"props":3340,"children":3341},{"style":254},[3342],{"type":49,"value":257},{"type":43,"tag":236,"props":3344,"children":3345},{"style":242},[3346],{"type":49,"value":1607},{"type":43,"tag":236,"props":3348,"children":3349},{"style":260},[3350],{"type":49,"value":3351}," maxConcurrent",{"type":43,"tag":236,"props":3353,"children":3354},{"style":254},[3355],{"type":49,"value":268},{"type":43,"tag":236,"props":3357,"children":3358},{"style":271},[3359],{"type":49,"value":847},{"type":43,"tag":236,"props":3361,"children":3362},{"style":254},[3363],{"type":49,"value":1265},{"type":43,"tag":236,"props":3365,"children":3366},{"style":254},[3367],{"type":49,"value":1653},{"type":43,"tag":236,"props":3369,"children":3370},{"class":238,"line":424},[3371],{"type":43,"tag":236,"props":3372,"children":3373},{"emptyLinePlaceholder":974},[3374],{"type":49,"value":977},{"type":43,"tag":236,"props":3376,"children":3377},{"class":238,"line":433},[3378,3382,3387,3391,3395,3399,3403,3407,3411,3415,3419,3423,3427,3431,3435,3439,3443,3447],{"type":43,"tag":236,"props":3379,"children":3380},{"style":242},[3381],{"type":49,"value":1668},{"type":43,"tag":236,"props":3383,"children":3384},{"style":302},[3385],{"type":49,"value":3386}," handle",{"type":43,"tag":236,"props":3388,"children":3389},{"style":254},[3390],{"type":49,"value":765},{"type":43,"tag":236,"props":3392,"children":3393},{"style":271},[3394],{"type":49,"value":770},{"type":43,"tag":236,"props":3396,"children":3397},{"style":254},[3398],{"type":49,"value":1686},{"type":43,"tag":236,"props":3400,"children":3401},{"style":248},[3402],{"type":49,"value":1691},{"type":43,"tag":236,"props":3404,"children":3405},{"style":254},[3406],{"type":49,"value":268},{"type":43,"tag":236,"props":3408,"children":3409},{"style":254},[3410],{"type":49,"value":792},{"type":43,"tag":236,"props":3412,"children":3413},{"style":242},[3414],{"type":49,"value":797},{"type":43,"tag":236,"props":3416,"children":3417},{"style":271},[3418],{"type":49,"value":802},{"type":43,"tag":236,"props":3420,"children":3421},{"style":254},[3422],{"type":49,"value":765},{"type":43,"tag":236,"props":3424,"children":3425},{"style":271},[3426],{"type":49,"value":770},{"type":43,"tag":236,"props":3428,"children":3429},{"style":254},[3430],{"type":49,"value":1720},{"type":43,"tag":236,"props":3432,"children":3433},{"style":271},[3434],{"type":49,"value":802},{"type":43,"tag":236,"props":3436,"children":3437},{"style":254},[3438],{"type":49,"value":765},{"type":43,"tag":236,"props":3440,"children":3441},{"style":271},[3442],{"type":49,"value":770},{"type":43,"tag":236,"props":3444,"children":3445},{"style":254},[3446],{"type":49,"value":904},{"type":43,"tag":236,"props":3448,"children":3449},{"style":254},[3450],{"type":49,"value":289},{"type":43,"tag":236,"props":3452,"children":3453},{"class":238,"line":443},[3454,3458,3462,3466,3471,3475,3479,3484,3488,3492,3496,3500,3504,3509,3513,3517,3522,3526,3530],{"type":43,"tag":236,"props":3455,"children":3456},{"style":296},[3457],{"type":49,"value":1748},{"type":43,"tag":236,"props":3459,"children":3460},{"style":302},[3461],{"type":49,"value":305},{"type":43,"tag":236,"props":3463,"children":3464},{"style":254},[3465],{"type":49,"value":1757},{"type":43,"tag":236,"props":3467,"children":3468},{"style":308},[3469],{"type":49,"value":3470},"active",{"type":43,"tag":236,"props":3472,"children":3473},{"style":254},[3474],{"type":49,"value":358},{"type":43,"tag":236,"props":3476,"children":3477},{"style":254},[3478],{"type":49,"value":1825},{"type":43,"tag":236,"props":3480,"children":3481},{"style":308},[3482],{"type":49,"value":3483},"maxConcurrent",{"type":43,"tag":236,"props":3485,"children":3486},{"style":302},[3487],{"type":49,"value":325},{"type":43,"tag":236,"props":3489,"children":3490},{"style":296},[3491],{"type":49,"value":1173},{"type":43,"tag":236,"props":3493,"children":3494},{"style":254},[3495],{"type":49,"value":1283},{"type":43,"tag":236,"props":3497,"children":3498},{"style":248},[3499],{"type":49,"value":320},{"type":43,"tag":236,"props":3501,"children":3502},{"style":302},[3503],{"type":49,"value":257},{"type":43,"tag":236,"props":3505,"children":3506},{"style":361},[3507],{"type":49,"value":3508},"503",{"type":43,"tag":236,"props":3510,"children":3511},{"style":254},[3512],{"type":49,"value":938},{"type":43,"tag":236,"props":3514,"children":3515},{"style":254},[3516],{"type":49,"value":1519},{"type":43,"tag":236,"props":3518,"children":3519},{"style":504},[3520],{"type":49,"value":3521},"Service overloaded",{"type":43,"tag":236,"props":3523,"children":3524},{"style":254},[3525],{"type":49,"value":501},{"type":43,"tag":236,"props":3527,"children":3528},{"style":302},[3529],{"type":49,"value":1265},{"type":43,"tag":236,"props":3531,"children":3532},{"style":254},[3533],{"type":49,"value":421},{"type":43,"tag":236,"props":3535,"children":3536},{"class":238,"line":534},[3537,3542,3546],{"type":43,"tag":236,"props":3538,"children":3539},{"style":254},[3540],{"type":49,"value":3541},"    this.",{"type":43,"tag":236,"props":3543,"children":3544},{"style":308},[3545],{"type":49,"value":3470},{"type":43,"tag":236,"props":3547,"children":3548},{"style":254},[3549],{"type":49,"value":2082},{"type":43,"tag":236,"props":3551,"children":3552},{"class":238,"line":552},[3553,3557,3561,3566,3570,3574,3578,3582],{"type":43,"tag":236,"props":3554,"children":3555},{"style":296},[3556],{"type":49,"value":1054},{"type":43,"tag":236,"props":3558,"children":3559},{"style":254},[3560],{"type":49,"value":832},{"type":43,"tag":236,"props":3562,"children":3563},{"style":296},[3564],{"type":49,"value":3565}," return",{"type":43,"tag":236,"props":3567,"children":3568},{"style":296},[3569],{"type":49,"value":1072},{"type":43,"tag":236,"props":3571,"children":3572},{"style":248},[3573],{"type":49,"value":1077},{"type":43,"tag":236,"props":3575,"children":3576},{"style":302},[3577],{"type":49,"value":1082},{"type":43,"tag":236,"props":3579,"children":3580},{"style":254},[3581],{"type":49,"value":852},{"type":43,"tag":236,"props":3583,"children":3584},{"style":254},[3585],{"type":49,"value":2523},{"type":43,"tag":236,"props":3587,"children":3588},{"class":238,"line":1061},[3589,3594,3598,3602,3606,3611],{"type":43,"tag":236,"props":3590,"children":3591},{"style":296},[3592],{"type":49,"value":3593},"    finally",{"type":43,"tag":236,"props":3595,"children":3596},{"style":254},[3597],{"type":49,"value":832},{"type":43,"tag":236,"props":3599,"children":3600},{"style":254},[3601],{"type":49,"value":1825},{"type":43,"tag":236,"props":3603,"children":3604},{"style":308},[3605],{"type":49,"value":3470},{"type":43,"tag":236,"props":3607,"children":3608},{"style":254},[3609],{"type":49,"value":3610},"--;",{"type":43,"tag":236,"props":3612,"children":3613},{"style":254},[3614],{"type":49,"value":2523},{"type":43,"tag":236,"props":3616,"children":3617},{"class":238,"line":1089},[3618],{"type":43,"tag":236,"props":3619,"children":3620},{"style":254},[3621],{"type":49,"value":430},{"type":43,"tag":236,"props":3623,"children":3624},{"class":238,"line":1119},[3625],{"type":43,"tag":236,"props":3626,"children":3627},{"style":254},[3628],{"type":49,"value":558},{"type":43,"tag":52,"props":3630,"children":3631},{},[3632],{"type":49,"value":3633},"A fast 503 tells the client \"try again later\" or \"try another instance\" instead of tying up its resources while it waits. Load shedding keeps accepted requests fast and healthy.",{"type":43,"tag":64,"props":3635,"children":3637},{"id":3636},"anti-patterns",[3638],{"type":49,"value":3639},"Anti-Patterns",{"type":43,"tag":76,"props":3641,"children":3643},{"className":228,"code":3642,"language":230,"meta":85,"style":85},"\u002F\u002F Retries all errors including 4xx; fixed interval, no jitter\nfor (let i = 0; i \u003C 3; i++) {\n  try { return await fetch(url); }\n  catch { await sleep(1000); }\n}\n\n\u002F\u002F Layer multiplication: 3 × 3 × 3 = 27 backend calls\ngateway: retry(3, () => serviceA())\nserviceA: retry(3, () => serviceB())\nserviceB: retry(3, () => database())\n\n\u002F\u002F Fresh timeout per retry: 30s × 4 attempts = 120s user wait\nfor (let i = 0; i \u003C 3; i++) {\n  try { return await callWithTimeout(service, 30_000); }\n  catch { continue; }\n}\n\n\u002F\u002F Library retries + app retries = silent multiplication\nconst axios = create({ retries: 3 });\nasync function call() { return retry(3, () => axios.get(url)); } \u002F\u002F 9 total\n",[3644],{"type":43,"tag":83,"props":3645,"children":3646},{"__ignoreMap":85},[3647,3655,3722,3768,3810,3817,3824,3832,3880,3924,3968,3975,3983,4046,4099,4123,4130,4137,4145,4200],{"type":43,"tag":236,"props":3648,"children":3649},{"class":238,"line":30},[3650],{"type":43,"tag":236,"props":3651,"children":3652},{"style":437},[3653],{"type":49,"value":3654},"\u002F\u002F Retries all errors including 4xx; fixed interval, no jitter\n",{"type":43,"tag":236,"props":3656,"children":3657},{"class":238,"line":292},[3658,3663,3667,3671,3676,3681,3685,3689,3693,3697,3701,3705,3710,3714,3718],{"type":43,"tag":236,"props":3659,"children":3660},{"style":296},[3661],{"type":49,"value":3662},"for",{"type":43,"tag":236,"props":3664,"children":3665},{"style":308},[3666],{"type":49,"value":305},{"type":43,"tag":236,"props":3668,"children":3669},{"style":242},[3670],{"type":49,"value":994},{"type":43,"tag":236,"props":3672,"children":3673},{"style":308},[3674],{"type":49,"value":3675}," i ",{"type":43,"tag":236,"props":3677,"children":3678},{"style":254},[3679],{"type":49,"value":3680},"=",{"type":43,"tag":236,"props":3682,"children":3683},{"style":361},[3684],{"type":49,"value":1008},{"type":43,"tag":236,"props":3686,"children":3687},{"style":254},[3688],{"type":49,"value":852},{"type":43,"tag":236,"props":3690,"children":3691},{"style":308},[3692],{"type":49,"value":3675},{"type":43,"tag":236,"props":3694,"children":3695},{"style":254},[3696],{"type":49,"value":765},{"type":43,"tag":236,"props":3698,"children":3699},{"style":361},[3700],{"type":49,"value":933},{"type":43,"tag":236,"props":3702,"children":3703},{"style":254},[3704],{"type":49,"value":852},{"type":43,"tag":236,"props":3706,"children":3707},{"style":308},[3708],{"type":49,"value":3709}," i",{"type":43,"tag":236,"props":3711,"children":3712},{"style":254},[3713],{"type":49,"value":1038},{"type":43,"tag":236,"props":3715,"children":3716},{"style":308},[3717],{"type":49,"value":325},{"type":43,"tag":236,"props":3719,"children":3720},{"style":254},[3721],{"type":49,"value":330},{"type":43,"tag":236,"props":3723,"children":3724},{"class":238,"line":26},[3725,3730,3734,3738,3742,3747,3751,3756,3760,3764],{"type":43,"tag":236,"props":3726,"children":3727},{"style":296},[3728],{"type":49,"value":3729},"  try",{"type":43,"tag":236,"props":3731,"children":3732},{"style":254},[3733],{"type":49,"value":832},{"type":43,"tag":236,"props":3735,"children":3736},{"style":296},[3737],{"type":49,"value":3565},{"type":43,"tag":236,"props":3739,"children":3740},{"style":296},[3741],{"type":49,"value":1072},{"type":43,"tag":236,"props":3743,"children":3744},{"style":248},[3745],{"type":49,"value":3746}," fetch",{"type":43,"tag":236,"props":3748,"children":3749},{"style":302},[3750],{"type":49,"value":257},{"type":43,"tag":236,"props":3752,"children":3753},{"style":308},[3754],{"type":49,"value":3755},"url",{"type":43,"tag":236,"props":3757,"children":3758},{"style":302},[3759],{"type":49,"value":1265},{"type":43,"tag":236,"props":3761,"children":3762},{"style":254},[3763],{"type":49,"value":852},{"type":43,"tag":236,"props":3765,"children":3766},{"style":254},[3767],{"type":49,"value":2523},{"type":43,"tag":236,"props":3769,"children":3770},{"class":238,"line":424},[3771,3776,3780,3784,3789,3793,3798,3802,3806],{"type":43,"tag":236,"props":3772,"children":3773},{"style":296},[3774],{"type":49,"value":3775},"  catch",{"type":43,"tag":236,"props":3777,"children":3778},{"style":254},[3779],{"type":49,"value":832},{"type":43,"tag":236,"props":3781,"children":3782},{"style":296},[3783],{"type":49,"value":1072},{"type":43,"tag":236,"props":3785,"children":3786},{"style":248},[3787],{"type":49,"value":3788}," sleep",{"type":43,"tag":236,"props":3790,"children":3791},{"style":302},[3792],{"type":49,"value":257},{"type":43,"tag":236,"props":3794,"children":3795},{"style":361},[3796],{"type":49,"value":3797},"1000",{"type":43,"tag":236,"props":3799,"children":3800},{"style":302},[3801],{"type":49,"value":1265},{"type":43,"tag":236,"props":3803,"children":3804},{"style":254},[3805],{"type":49,"value":852},{"type":43,"tag":236,"props":3807,"children":3808},{"style":254},[3809],{"type":49,"value":2523},{"type":43,"tag":236,"props":3811,"children":3812},{"class":238,"line":433},[3813],{"type":43,"tag":236,"props":3814,"children":3815},{"style":254},[3816],{"type":49,"value":558},{"type":43,"tag":236,"props":3818,"children":3819},{"class":238,"line":443},[3820],{"type":43,"tag":236,"props":3821,"children":3822},{"emptyLinePlaceholder":974},[3823],{"type":49,"value":977},{"type":43,"tag":236,"props":3825,"children":3826},{"class":238,"line":534},[3827],{"type":43,"tag":236,"props":3828,"children":3829},{"style":437},[3830],{"type":49,"value":3831},"\u002F\u002F Layer multiplication: 3 × 3 × 3 = 27 backend calls\n",{"type":43,"tag":236,"props":3833,"children":3834},{"class":238,"line":552},[3835,3840,3844,3849,3853,3858,3862,3866,3870,3875],{"type":43,"tag":236,"props":3836,"children":3837},{"style":271},[3838],{"type":49,"value":3839},"gateway",{"type":43,"tag":236,"props":3841,"children":3842},{"style":254},[3843],{"type":49,"value":268},{"type":43,"tag":236,"props":3845,"children":3846},{"style":248},[3847],{"type":49,"value":3848}," retry",{"type":43,"tag":236,"props":3850,"children":3851},{"style":308},[3852],{"type":49,"value":257},{"type":43,"tag":236,"props":3854,"children":3855},{"style":361},[3856],{"type":49,"value":3857},"3",{"type":43,"tag":236,"props":3859,"children":3860},{"style":254},[3861],{"type":49,"value":938},{"type":43,"tag":236,"props":3863,"children":3864},{"style":254},[3865],{"type":49,"value":792},{"type":43,"tag":236,"props":3867,"children":3868},{"style":242},[3869],{"type":49,"value":797},{"type":43,"tag":236,"props":3871,"children":3872},{"style":248},[3873],{"type":49,"value":3874}," serviceA",{"type":43,"tag":236,"props":3876,"children":3877},{"style":308},[3878],{"type":49,"value":3879},"())\n",{"type":43,"tag":236,"props":3881,"children":3882},{"class":238,"line":1061},[3883,3887,3891,3895,3899,3903,3907,3911,3915,3920],{"type":43,"tag":236,"props":3884,"children":3885},{"style":271},[3886],{"type":49,"value":2876},{"type":43,"tag":236,"props":3888,"children":3889},{"style":254},[3890],{"type":49,"value":268},{"type":43,"tag":236,"props":3892,"children":3893},{"style":248},[3894],{"type":49,"value":3848},{"type":43,"tag":236,"props":3896,"children":3897},{"style":308},[3898],{"type":49,"value":257},{"type":43,"tag":236,"props":3900,"children":3901},{"style":361},[3902],{"type":49,"value":3857},{"type":43,"tag":236,"props":3904,"children":3905},{"style":254},[3906],{"type":49,"value":938},{"type":43,"tag":236,"props":3908,"children":3909},{"style":254},[3910],{"type":49,"value":792},{"type":43,"tag":236,"props":3912,"children":3913},{"style":242},[3914],{"type":49,"value":797},{"type":43,"tag":236,"props":3916,"children":3917},{"style":248},[3918],{"type":49,"value":3919}," serviceB",{"type":43,"tag":236,"props":3921,"children":3922},{"style":308},[3923],{"type":49,"value":3879},{"type":43,"tag":236,"props":3925,"children":3926},{"class":238,"line":1089},[3927,3931,3935,3939,3943,3947,3951,3955,3959,3964],{"type":43,"tag":236,"props":3928,"children":3929},{"style":271},[3930],{"type":49,"value":2933},{"type":43,"tag":236,"props":3932,"children":3933},{"style":254},[3934],{"type":49,"value":268},{"type":43,"tag":236,"props":3936,"children":3937},{"style":248},[3938],{"type":49,"value":3848},{"type":43,"tag":236,"props":3940,"children":3941},{"style":308},[3942],{"type":49,"value":257},{"type":43,"tag":236,"props":3944,"children":3945},{"style":361},[3946],{"type":49,"value":3857},{"type":43,"tag":236,"props":3948,"children":3949},{"style":254},[3950],{"type":49,"value":938},{"type":43,"tag":236,"props":3952,"children":3953},{"style":254},[3954],{"type":49,"value":792},{"type":43,"tag":236,"props":3956,"children":3957},{"style":242},[3958],{"type":49,"value":797},{"type":43,"tag":236,"props":3960,"children":3961},{"style":248},[3962],{"type":49,"value":3963}," database",{"type":43,"tag":236,"props":3965,"children":3966},{"style":308},[3967],{"type":49,"value":3879},{"type":43,"tag":236,"props":3969,"children":3970},{"class":238,"line":1119},[3971],{"type":43,"tag":236,"props":3972,"children":3973},{"emptyLinePlaceholder":974},[3974],{"type":49,"value":977},{"type":43,"tag":236,"props":3976,"children":3977},{"class":238,"line":1184},[3978],{"type":43,"tag":236,"props":3979,"children":3980},{"style":437},[3981],{"type":49,"value":3982},"\u002F\u002F Fresh timeout per retry: 30s × 4 attempts = 120s user wait\n",{"type":43,"tag":236,"props":3984,"children":3985},{"class":238,"line":1193},[3986,3990,3994,3998,4002,4006,4010,4014,4018,4022,4026,4030,4034,4038,4042],{"type":43,"tag":236,"props":3987,"children":3988},{"style":296},[3989],{"type":49,"value":3662},{"type":43,"tag":236,"props":3991,"children":3992},{"style":308},[3993],{"type":49,"value":305},{"type":43,"tag":236,"props":3995,"children":3996},{"style":242},[3997],{"type":49,"value":994},{"type":43,"tag":236,"props":3999,"children":4000},{"style":308},[4001],{"type":49,"value":3675},{"type":43,"tag":236,"props":4003,"children":4004},{"style":254},[4005],{"type":49,"value":3680},{"type":43,"tag":236,"props":4007,"children":4008},{"style":361},[4009],{"type":49,"value":1008},{"type":43,"tag":236,"props":4011,"children":4012},{"style":254},[4013],{"type":49,"value":852},{"type":43,"tag":236,"props":4015,"children":4016},{"style":308},[4017],{"type":49,"value":3675},{"type":43,"tag":236,"props":4019,"children":4020},{"style":254},[4021],{"type":49,"value":765},{"type":43,"tag":236,"props":4023,"children":4024},{"style":361},[4025],{"type":49,"value":933},{"type":43,"tag":236,"props":4027,"children":4028},{"style":254},[4029],{"type":49,"value":852},{"type":43,"tag":236,"props":4031,"children":4032},{"style":308},[4033],{"type":49,"value":3709},{"type":43,"tag":236,"props":4035,"children":4036},{"style":254},[4037],{"type":49,"value":1038},{"type":43,"tag":236,"props":4039,"children":4040},{"style":308},[4041],{"type":49,"value":325},{"type":43,"tag":236,"props":4043,"children":4044},{"style":254},[4045],{"type":49,"value":330},{"type":43,"tag":236,"props":4047,"children":4048},{"class":238,"line":1272},[4049,4053,4057,4061,4065,4070,4074,4079,4083,4087,4091,4095],{"type":43,"tag":236,"props":4050,"children":4051},{"style":296},[4052],{"type":49,"value":3729},{"type":43,"tag":236,"props":4054,"children":4055},{"style":254},[4056],{"type":49,"value":832},{"type":43,"tag":236,"props":4058,"children":4059},{"style":296},[4060],{"type":49,"value":3565},{"type":43,"tag":236,"props":4062,"children":4063},{"style":296},[4064],{"type":49,"value":1072},{"type":43,"tag":236,"props":4066,"children":4067},{"style":248},[4068],{"type":49,"value":4069}," callWithTimeout",{"type":43,"tag":236,"props":4071,"children":4072},{"style":302},[4073],{"type":49,"value":257},{"type":43,"tag":236,"props":4075,"children":4076},{"style":308},[4077],{"type":49,"value":4078},"service",{"type":43,"tag":236,"props":4080,"children":4081},{"style":254},[4082],{"type":49,"value":938},{"type":43,"tag":236,"props":4084,"children":4085},{"style":361},[4086],{"type":49,"value":1644},{"type":43,"tag":236,"props":4088,"children":4089},{"style":302},[4090],{"type":49,"value":1265},{"type":43,"tag":236,"props":4092,"children":4093},{"style":254},[4094],{"type":49,"value":852},{"type":43,"tag":236,"props":4096,"children":4097},{"style":254},[4098],{"type":49,"value":2523},{"type":43,"tag":236,"props":4100,"children":4101},{"class":238,"line":1341},[4102,4106,4110,4115,4119],{"type":43,"tag":236,"props":4103,"children":4104},{"style":296},[4105],{"type":49,"value":3775},{"type":43,"tag":236,"props":4107,"children":4108},{"style":254},[4109],{"type":49,"value":832},{"type":43,"tag":236,"props":4111,"children":4112},{"style":296},[4113],{"type":49,"value":4114}," continue",{"type":43,"tag":236,"props":4116,"children":4117},{"style":254},[4118],{"type":49,"value":852},{"type":43,"tag":236,"props":4120,"children":4121},{"style":254},[4122],{"type":49,"value":2523},{"type":43,"tag":236,"props":4124,"children":4125},{"class":238,"line":1350},[4126],{"type":43,"tag":236,"props":4127,"children":4128},{"style":254},[4129],{"type":49,"value":558},{"type":43,"tag":236,"props":4131,"children":4132},{"class":238,"line":1358},[4133],{"type":43,"tag":236,"props":4134,"children":4135},{"emptyLinePlaceholder":974},[4136],{"type":49,"value":977},{"type":43,"tag":236,"props":4138,"children":4139},{"class":238,"line":1401},[4140],{"type":43,"tag":236,"props":4141,"children":4142},{"style":437},[4143],{"type":49,"value":4144},"\u002F\u002F Library retries + app retries = silent multiplication\n",{"type":43,"tag":236,"props":4146,"children":4147},{"class":238,"line":2068},[4148,4153,4158,4162,4167,4171,4176,4180,4184,4188,4192,4196],{"type":43,"tag":236,"props":4149,"children":4150},{"style":242},[4151],{"type":49,"value":4152},"const",{"type":43,"tag":236,"props":4154,"children":4155},{"style":308},[4156],{"type":49,"value":4157}," axios ",{"type":43,"tag":236,"props":4159,"children":4160},{"style":254},[4161],{"type":49,"value":3680},{"type":43,"tag":236,"props":4163,"children":4164},{"style":248},[4165],{"type":49,"value":4166}," create",{"type":43,"tag":236,"props":4168,"children":4169},{"style":308},[4170],{"type":49,"value":257},{"type":43,"tag":236,"props":4172,"children":4173},{"style":254},[4174],{"type":49,"value":4175},"{",{"type":43,"tag":236,"props":4177,"children":4178},{"style":302},[4179],{"type":49,"value":2308},{"type":43,"tag":236,"props":4181,"children":4182},{"style":254},[4183],{"type":49,"value":268},{"type":43,"tag":236,"props":4185,"children":4186},{"style":361},[4187],{"type":49,"value":933},{"type":43,"tag":236,"props":4189,"children":4190},{"style":254},[4191],{"type":49,"value":870},{"type":43,"tag":236,"props":4193,"children":4194},{"style":308},[4195],{"type":49,"value":1265},{"type":43,"tag":236,"props":4197,"children":4198},{"style":254},[4199],{"type":49,"value":421},{"type":43,"tag":236,"props":4201,"children":4202},{"class":238,"line":2085},[4203,4207,4211,4215,4219,4223,4227,4231,4235,4239,4243,4247,4251,4256,4260,4265,4269,4273,4277,4281,4285],{"type":43,"tag":236,"props":4204,"children":4205},{"style":242},[4206],{"type":49,"value":750},{"type":43,"tag":236,"props":4208,"children":4209},{"style":242},[4210],{"type":49,"value":755},{"type":43,"tag":236,"props":4212,"children":4213},{"style":248},[4214],{"type":49,"value":1673},{"type":43,"tag":236,"props":4216,"children":4217},{"style":254},[4218],{"type":49,"value":1082},{"type":43,"tag":236,"props":4220,"children":4221},{"style":254},[4222],{"type":49,"value":832},{"type":43,"tag":236,"props":4224,"children":4225},{"style":296},[4226],{"type":49,"value":3565},{"type":43,"tag":236,"props":4228,"children":4229},{"style":248},[4230],{"type":49,"value":3848},{"type":43,"tag":236,"props":4232,"children":4233},{"style":302},[4234],{"type":49,"value":257},{"type":43,"tag":236,"props":4236,"children":4237},{"style":361},[4238],{"type":49,"value":3857},{"type":43,"tag":236,"props":4240,"children":4241},{"style":254},[4242],{"type":49,"value":938},{"type":43,"tag":236,"props":4244,"children":4245},{"style":254},[4246],{"type":49,"value":792},{"type":43,"tag":236,"props":4248,"children":4249},{"style":242},[4250],{"type":49,"value":797},{"type":43,"tag":236,"props":4252,"children":4253},{"style":308},[4254],{"type":49,"value":4255}," axios",{"type":43,"tag":236,"props":4257,"children":4258},{"style":254},[4259],{"type":49,"value":348},{"type":43,"tag":236,"props":4261,"children":4262},{"style":248},[4263],{"type":49,"value":4264},"get",{"type":43,"tag":236,"props":4266,"children":4267},{"style":302},[4268],{"type":49,"value":257},{"type":43,"tag":236,"props":4270,"children":4271},{"style":308},[4272],{"type":49,"value":3755},{"type":43,"tag":236,"props":4274,"children":4275},{"style":302},[4276],{"type":49,"value":1334},{"type":43,"tag":236,"props":4278,"children":4279},{"style":254},[4280],{"type":49,"value":852},{"type":43,"tag":236,"props":4282,"children":4283},{"style":254},[4284],{"type":49,"value":870},{"type":43,"tag":236,"props":4286,"children":4287},{"style":437},[4288],{"type":49,"value":4289}," \u002F\u002F 9 total\n",{"type":43,"tag":64,"props":4291,"children":4293},{"id":4292},"related-traps",[4294],{"type":49,"value":4295},"Related Traps",{"type":43,"tag":4297,"props":4298,"children":4299},"ul",{},[4300,4310,4320,4330],{"type":43,"tag":145,"props":4301,"children":4302},{},[4303,4308],{"type":43,"tag":58,"props":4304,"children":4305},{},[4306],{"type":49,"value":4307},"Thundering Herd",{"type":49,"value":4309}," -- retries without jitter create thundering herds: all clients that failed together retry together. Exponential backoff with jitter is the same fix for both.",{"type":43,"tag":145,"props":4311,"children":4312},{},[4313,4318],{"type":43,"tag":58,"props":4314,"children":4315},{},[4316],{"type":49,"value":4317},"Idempotency",{"type":49,"value":4319}," -- every operation you retry MUST be idempotent. Retrying a payment without an idempotency key charges the customer multiple times. Retries and idempotency are inseparable.",{"type":43,"tag":145,"props":4321,"children":4322},{},[4323,4328],{"type":43,"tag":58,"props":4324,"children":4325},{},[4326],{"type":49,"value":4327},"Distributed System Fallacies",{"type":49,"value":4329}," -- fallacy #1 (the network is reliable) leads to both \"no retries\" and \"too many retries.\" The correct middle ground is limited, budgeted retries with circuit breakers.",{"type":43,"tag":145,"props":4331,"children":4332},{},[4333,4338],{"type":43,"tag":58,"props":4334,"children":4335},{},[4336],{"type":49,"value":4337},"Backpressure",{"type":49,"value":4339}," -- retries without budgets are a backpressure violation. Each retry adds work to an overwhelmed system instead of slowing down.",{"type":43,"tag":4341,"props":4342,"children":4343},"style",{},[4344],{"type":49,"value":4345},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":4347,"total":4511},[4348,4367,4380,4390,4407,4422,4436,4453,4466,4478,4489,4498],{"slug":4349,"name":4349,"fn":4350,"description":4351,"org":4352,"tags":4353,"stars":4364,"repoUrl":4365,"updatedAt":4366},"trigger-authoring-chat-agent","author durable AI chat agents with Trigger.dev","Author and run a durable AI chat agent with chat.agent from @trigger.dev\u002Fsdk\u002Fai: the per-turn run loop, why you MUST spread ...chat.toStreamTextOptions() first, returning a StreamTextResult vs calling chat.pipe(), the two server actions (chat.createStartSessionAction + auth.createPublicToken), and wiring useChat to useTriggerChatTransport. Load this when building, modifying, or debugging a chat backend (the agent task or its lifecycle hooks) or its React transport, when declaring typed tools or custom data parts, or when migrating a plain AI SDK streamText route to chat.agent.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4354,4357,4360,4361],{"name":4355,"slug":4356,"type":16},"Agents","agents",{"name":4358,"slug":4359,"type":16},"SDK","sdk",{"name":9,"slug":8,"type":16},{"name":4362,"slug":4363,"type":16},"Workflow Automation","workflow-automation",14401,"https:\u002F\u002Fgithub.com\u002Ftriggerdotdev\u002Ftrigger.dev","2026-07-02T17:12:52.307135",{"slug":4368,"name":4368,"fn":4369,"description":4370,"org":4371,"tags":4372,"stars":4364,"repoUrl":4365,"updatedAt":4379},"trigger-authoring-tasks","author backend Trigger.dev tasks","Covers writing backend Trigger.dev tasks with @trigger.dev\u002Fsdk: defining task() and schemaTask(), the run function and its ctx, retries, waits, queues and concurrency, idempotency keys, run metadata, logging, triggering other tasks (and the Result shape), scheduled\u002Fcron tasks, and the essentials of trigger.config.ts. Load this whenever you are authoring or editing code inside a \u002Ftrigger directory, defining a task, or writing backend code that triggers tasks. Realtime\u002FReact hooks and AI chat are covered by separate skills.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4373,4376,4377,4378],{"name":4374,"slug":4375,"type":16},"Backend","backend",{"name":4358,"slug":4359,"type":16},{"name":9,"slug":8,"type":16},{"name":4362,"slug":4363,"type":16},"2026-07-02T17:12:48.396964",{"slug":4381,"name":4381,"fn":4382,"description":4383,"org":4384,"tags":4385,"stars":4364,"repoUrl":4365,"updatedAt":4389},"trigger-chat-agent-advanced","manage Trigger.dev chat sessions and transports","Advanced and operational chat.agent capabilities for Trigger.dev, loaded on demand. Load this when working on the raw Sessions primitive (sessions \u002F SessionHandle), a custom chat transport or the realtime wire protocol, durable sub-agents (AgentChat, chat.stream.writer), human-in-the-loop, steering, actions, background injection (chat.defer \u002F chat.inject), fast starts (preload, Head Start via @trigger.dev\u002Fsdk\u002Fchat-server), context resilience (compaction, recovery boot, OOM, large payloads), chat.local run-scoped state, offline testing with mockChatAgent, or prerelease\u002Fversion upgrades. For the everyday chat.agent({...}) definition and the useTriggerChatTransport happy path, use the trigger-authoring-chat-agent skill instead.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4386,4387,4388],{"name":4355,"slug":4356,"type":16},{"name":9,"slug":8,"type":16},{"name":4362,"slug":4363,"type":16},"2026-07-02T17:12:51.03018",{"slug":4391,"name":4391,"fn":4392,"description":4393,"org":4394,"tags":4395,"stars":4364,"repoUrl":4365,"updatedAt":4406},"trigger-realtime-and-frontend","subscribe to Trigger.dev runs in realtime","Trigger.dev client\u002Ffrontend surface: subscribe to runs in realtime (runs.subscribeToRun and the @trigger.dev\u002Freact-hooks hook useRealtimeRun), consume metadata and AI\u002Ftext streams in React (useRealtimeStream), trigger tasks from the browser (useTaskTrigger, useRealtimeTaskTrigger), and mint scoped frontend credentials with auth.createPublicToken \u002F auth.createTriggerPublicToken. Load when wiring a frontend (React\u002FNext.js\u002FRemix) or backend-for-frontend to show live run progress, status badges, token streams, trigger buttons, or wait-token approval UIs. NOT for writing the backend task itself (streams.define \u002F metadata.set is trigger-authoring-tasks territory); this is the consumer side.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4396,4399,4402,4405],{"name":4397,"slug":4398,"type":16},"Frontend","frontend",{"name":4400,"slug":4401,"type":16},"React","react",{"name":4403,"slug":4404,"type":16},"Real-time","real-time",{"name":9,"slug":8,"type":16},"2026-07-02T17:12:49.717706",{"slug":4408,"name":4408,"fn":4409,"description":4410,"org":4411,"tags":4412,"stars":4419,"repoUrl":4420,"updatedAt":4421},"trigger-agents","orchestrate AI agents with Trigger.dev","AI agent patterns with Trigger.dev - orchestration, parallelization, routing, evaluator-optimizer, and human-in-the-loop. Use when building LLM-powered tasks that need parallel workers, approval gates, tool calling, or multi-step agent workflows.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4413,4414,4417,4418],{"name":4355,"slug":4356,"type":16},{"name":4415,"slug":4416,"type":16},"Multi-Agent","multi-agent",{"name":9,"slug":8,"type":16},{"name":4362,"slug":4363,"type":16},30,"https:\u002F\u002Fgithub.com\u002Ftriggerdotdev\u002Fskills","2026-04-06T18:54:46.023553",{"slug":4423,"name":4423,"fn":4424,"description":4425,"org":4426,"tags":4427,"stars":4419,"repoUrl":4420,"updatedAt":4435},"trigger-config","configure Trigger.dev project settings","Configure Trigger.dev projects with trigger.config.ts. Use when setting up build extensions for Prisma, Playwright, FFmpeg, Python, or customizing deployment settings.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4428,4431,4434],{"name":4429,"slug":4430,"type":16},"Configuration","configuration",{"name":4432,"slug":4433,"type":16},"Deployment","deployment",{"name":9,"slug":8,"type":16},"2026-04-06T18:54:44.764258",{"slug":4437,"name":4437,"fn":4438,"description":4439,"org":4440,"tags":4441,"stars":4419,"repoUrl":4420,"updatedAt":4452},"trigger-cost-savings","optimize Trigger.dev task costs","Analyze Trigger.dev tasks, schedules, and runs for cost optimization opportunities. Use when asked to reduce spend, optimize costs, audit usage, right-size machines, or review task efficiency. Requires Trigger.dev MCP tools for run analysis.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4442,4445,4448,4451],{"name":4443,"slug":4444,"type":16},"Analytics","analytics",{"name":4446,"slug":4447,"type":16},"Cost Optimization","cost-optimization",{"name":4449,"slug":4450,"type":16},"Operations","operations",{"name":9,"slug":8,"type":16},"2026-04-06T18:54:48.555552",{"slug":4454,"name":4454,"fn":4455,"description":4456,"org":4457,"tags":4458,"stars":4419,"repoUrl":4420,"updatedAt":4465},"trigger-realtime","monitor Trigger.dev tasks in real-time","Subscribe to Trigger.dev task runs in real-time from frontend and backend. Use when building progress indicators, live dashboards, streaming AI\u002FLLM responses, or React components that display task status.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4459,4460,4463,4464],{"name":4397,"slug":4398,"type":16},{"name":4461,"slug":4462,"type":16},"Observability","observability",{"name":4403,"slug":4404,"type":16},{"name":9,"slug":8,"type":16},"2026-04-06T18:54:47.293822",{"slug":4467,"name":4467,"fn":4468,"description":4469,"org":4470,"tags":4471,"stars":4419,"repoUrl":4420,"updatedAt":4477},"trigger-setup","set up Trigger.dev in projects","Set up Trigger.dev in your project. Use when adding Trigger.dev for the first time, creating trigger.config.ts, or initializing the trigger directory.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4472,4473,4476],{"name":4429,"slug":4430,"type":16},{"name":4474,"slug":4475,"type":16},"Local Development","local-development",{"name":9,"slug":8,"type":16},"2026-04-06T18:54:42.280816",{"slug":4479,"name":4479,"fn":4480,"description":4481,"org":4482,"tags":4483,"stars":4419,"repoUrl":4420,"updatedAt":4488},"trigger-tasks","build durable background tasks with Trigger.dev","Build AI agents, workflows and durable background tasks with Trigger.dev. Use when creating tasks, triggering jobs, handling retries, scheduling cron jobs, or implementing queues and concurrency control.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4484,4485,4486,4487],{"name":4355,"slug":4356,"type":16},{"name":4374,"slug":4375,"type":16},{"name":9,"slug":8,"type":16},{"name":4362,"slug":4363,"type":16},"2026-04-06T18:54:43.514369",{"slug":4490,"name":4490,"fn":4491,"description":4492,"org":4493,"tags":4494,"stars":26,"repoUrl":27,"updatedAt":4497},"staff-engineering-skills-backpressure","implement backpressure in streaming pipelines","Prevent unbounded resource growth when producers outpace consumers. Use when writing producer-consumer code, queue processing, batch operations, fan-out patterns, streaming pipelines, or any code where work is generated faster than it can be processed. Activates on patterns like Promise.all on dynamic-sized arrays, unbounded in-memory queues, producer loops without depth checks, fire-and-forget async calls in loops, or any buffer between a producer and consumer without a size limit.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4495,4496],{"name":18,"slug":19,"type":16},{"name":14,"slug":15,"type":16},"2026-06-17T08:40:42.723559",{"slug":4499,"name":4499,"fn":4500,"description":4501,"org":4502,"tags":4503,"stars":26,"repoUrl":27,"updatedAt":4510},"staff-engineering-skills-cache-invalidation","implement cache invalidation strategies","Prevent stale data bugs caused by missing or incomplete cache invalidation. Use when adding caching layers (Redis, in-memory Map, CDN, HTTP cache headers), optimizing read performance, or reviewing code that caches query results, API responses, or computed values. Activates on patterns like cache.set without cache.delete on write paths, unbounded Map\u002Fobject caches, TTL-only invalidation on security-sensitive data, Cache-Control headers on mutable content, or any caching where the write path doesn't invalidate the read cache.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4504,4505,4508,4509],{"name":18,"slug":19,"type":16},{"name":4506,"slug":4507,"type":16},"Caching","caching",{"name":21,"slug":22,"type":16},{"name":14,"slug":15,"type":16},"2026-06-17T08:40:45.194583",26,{"items":4513,"total":1350},[4514,4519,4526,4536,4548,4561,4573],{"slug":4490,"name":4490,"fn":4491,"description":4492,"org":4515,"tags":4516,"stars":26,"repoUrl":27,"updatedAt":4497},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4517,4518],{"name":18,"slug":19,"type":16},{"name":14,"slug":15,"type":16},{"slug":4499,"name":4499,"fn":4500,"description":4501,"org":4520,"tags":4521,"stars":26,"repoUrl":27,"updatedAt":4510},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4522,4523,4524,4525],{"name":18,"slug":19,"type":16},{"name":4506,"slug":4507,"type":16},{"name":21,"slug":22,"type":16},{"name":14,"slug":15,"type":16},{"slug":4527,"name":4527,"fn":4528,"description":4529,"org":4530,"tags":4531,"stars":26,"repoUrl":27,"updatedAt":4535},"staff-engineering-skills-cardinality","prevent cardinality traps in systems code","Detect and prevent cardinality traps in systems code. Use when writing code that iterates over collections, stores items in memory, creates per-entity resources, or fans out operations across a set of items. Activates on patterns like loops over query results, in-memory Maps\u002FSets populated from databases, or \"one X per Y\" resource allocation.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4532,4533,4534],{"name":18,"slug":19,"type":16},{"name":21,"slug":22,"type":16},{"name":14,"slug":15,"type":16},"2026-06-17T08:40:40.264608",{"slug":4537,"name":4537,"fn":4538,"description":4539,"org":4540,"tags":4541,"stars":26,"repoUrl":27,"updatedAt":4547},"staff-engineering-skills-clock-skew","prevent clock skew bugs in distributed systems","Prevent bugs caused by assuming clocks are synchronized or monotonic. Use when writing code that compares timestamps across machines, measures durations, sets lock expiry, orders distributed events, deduplicates by time window, or uses Date.now() for anything other than logging or display. Activates on patterns like Date.now() used for duration measurement, absolute timestamp expiry shared across machines, wall clock timestamps for event ordering, last-write-wins conflict resolution with timestamps, or timeout calculations using wall clock time.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4542,4543,4546],{"name":18,"slug":19,"type":16},{"name":4544,"slug":4545,"type":16},"Debugging","debugging",{"name":21,"slug":22,"type":16},"2026-06-17T08:40:37.803541",{"slug":4549,"name":4549,"fn":4550,"description":4551,"org":4552,"tags":4553,"stars":26,"repoUrl":27,"updatedAt":4560},"staff-engineering-skills-consistency-models","manage consistency models in distributed systems","Prevent stale read bugs caused by replica lag, cache staleness, and index delay. Use when writing code that reads data after writing it, uses read replicas, caches query results, reads from search indexes, or builds event-driven read models. Activates on patterns like create-then-redirect, update-then-read, cache-aside with TTL, search-after-create, or any write followed by a read that might hit a different data source.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4554,4555,4558,4559],{"name":18,"slug":19,"type":16},{"name":4556,"slug":4557,"type":16},"Database","database",{"name":21,"slug":22,"type":16},{"name":14,"slug":15,"type":16},"2026-06-17T08:40:46.442182",{"slug":4562,"name":4562,"fn":4563,"description":4564,"org":4565,"tags":4566,"stars":26,"repoUrl":27,"updatedAt":4572},"staff-engineering-skills-denormalization","prevent data model denormalization traps","Detect and prevent denormalization traps when designing data models. Use when writing code that copies fields between tables, embeds related data in documents, caches composed objects, or adds redundant columns to avoid joins. Activates on patterns like storing derived\u002Fcopied data, syncing fields across tables, or embedding nested objects in document stores.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4567,4568,4571],{"name":18,"slug":19,"type":16},{"name":4569,"slug":4570,"type":16},"Data Modeling","data-modeling",{"name":4556,"slug":4557,"type":16},"2026-06-17T08:40:53.835868",{"slug":4574,"name":4574,"fn":4575,"description":4576,"org":4577,"tags":4578,"stars":26,"repoUrl":27,"updatedAt":4582},"staff-engineering-skills-distributed-system-fallacies","design resilient distributed systems","Prevent failures caused by treating network calls like function calls. Use when writing code that calls external services, splits a monolith into microservices, chains multiple API calls, orchestrates distributed workflows, or handles requests that depend on other services. Activates on patterns like sequential service calls without timeouts, fetch\u002Faxios calls without error handling, multi-service writes without compensation, hardcoded service URLs, or any code that assumes the network is reliable, fast, or free.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[4579,4580,4581],{"name":24,"slug":25,"type":16},{"name":18,"slug":19,"type":16},{"name":21,"slug":22,"type":16},"2026-06-17T08:40:47.666795"]