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