Commit e845ba5
committed
perf(delta-upgrade): lazy chain walk, GHCR retry, parallel I/O, offline cache
Four performance optimizations for the delta upgrade system:
## Lazy chain resolution (replaces eager graph build)
Replace buildNightlyPatchGraph + walkNightlyChain with a lazy approach
in resolveNightlyChain:
- List all patch tags (1 HTTP call, kept)
- Filter tags to only those between currentVersion and targetVersion
using Bun.semver.order() — since patches are sequential, this gives
the exact chain without fetching any manifests
- Sort filtered tags by version
- Fetch only the 1-2 manifests in the chain (instead of all N)
This reduces manifest fetches from ~14 to 1-2 for typical upgrades.
## Retry with timeout for GHCR requests
Add fetchWithRetry helper in ghcr.ts:
- 10s timeout per request (AbortSignal.timeout)
- 1 retry on transient errors (timeout, network, connection reset)
- Applied to getAnonymousToken, fetchManifest, fetchTagPage
- downloadNightlyBlob gets 30s timeout (no retry — large downloads)
## Parallel I/O
fetchManifest(targetTag) and listTags() run concurrently via Promise.all
after token acquisition — both only depend on the token, not each other.
## Patch pre-fetch for offline upgrades
New file-based cache in ~/.sentry/patch-cache/ enables fully offline
delta upgrades for both nightly and stable channels:
- Background version check now pre-fetches delta patches (~50-80KB)
after discovering a new version
- Patches accumulate across runs: skip 3 versions, all 3 patches are
cached, multi-hop upgrade is fully offline
- resolveStableDelta/resolveNightlyDelta check cache before network
- delta.source span attribute tracks cache vs network for telemetry
- 7-day TTL with opportunistic cleanup during version checks
- Two-pass cleanup preserves shared patches referenced by live chains1 parent ea2925a commit e845ba5
File tree
9 files changed
+1709
-604
lines changed- src/lib
- test
- isolated
- lib
9 files changed
+1709
-604
lines changedLarge diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
23 | 99 | | |
24 | 100 | | |
25 | 101 | | |
| |||
81 | 157 | | |
82 | 158 | | |
83 | 159 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
96 | 165 | | |
97 | 166 | | |
98 | 167 | | |
| |||
125 | 194 | | |
126 | 195 | | |
127 | 196 | | |
128 | | - | |
129 | | - | |
130 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
131 | 200 | | |
132 | 201 | | |
133 | 202 | | |
134 | 203 | | |
135 | 204 | | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
144 | 208 | | |
145 | 209 | | |
146 | 210 | | |
| |||
244 | 308 | | |
245 | 309 | | |
246 | 310 | | |
| 311 | + | |
247 | 312 | | |
248 | 313 | | |
249 | 314 | | |
| |||
275 | 340 | | |
276 | 341 | | |
277 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
278 | 348 | | |
279 | 349 | | |
280 | 350 | | |
| |||
324 | 394 | | |
325 | 395 | | |
326 | 396 | | |
327 | | - | |
328 | | - | |
329 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
330 | 400 | | |
331 | 401 | | |
332 | 402 | | |
333 | 403 | | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
339 | 407 | | |
340 | 408 | | |
341 | 409 | | |
| |||
0 commit comments