Commit 38db91f
committed
ref(builds-cacher): cache-only Node server, no fetches or writes
Make _webi/builds-cacher.js and _webi/transform-releases.js read
exclusively from ~/.cache/webi/legacy/<name>.json and remove every code
path that fetched from upstream or wrote to disk. The Go cache daemon
(webicached) is now the sole writer; the Node server is a thin reader.
builds-cacher.js:
- Resolve cache files via Os.homedir() + '/.cache/webi/legacy/' instead
of the cacheDir argument. Drop the 'caches' constructor parameter.
- Remove getLatestBuilds / getLatestBuildsInner — they require()d
per-package releases.js modules, fetched upstream, and wrote
<yyyy-mm>/<name>.json + .updated.txt to disk.
- Remove the process.nextTick stale-refresh hook in _doGetPackages.
Cold reads return what's on disk; if the file is missing, return
empty meta instead of fetching.
- Remove freshenRandomPackage and its supporting state
(bc._staleNames, bc._freshenTimeout, bc._staleAge). The hourly
background freshener competed with webicached for the same files.
- In getProjectTypeByEntry, decide selfhosted vs valid by probing for
the cache file rather than require()-ing releases.js. Drop the
not_found / 'PROBLEM/SOLUTION/npm clean-install' diagnostic in
getProjectsByType — the cache-file probe replaces the module-load
failure mode.
transform-releases.js:
- Remove Releases.get and the _normalize import. Replace
getCachedReleases's fetch+race+stale-age machinery with a single
Fs.readFile of ~/.cache/webi/legacy/<pkg>.json.
- Drop the in-process version re-sort in createFormatsSorter; the
cache file is already version-sorted by webicached, so the sorter
only re-orders within the same version.
No callers' public signatures change. Every other file is untouched —
the per-package releases.js modules, _common/*.js fetchers, and
_webi/normalize.js still exist on disk but are no longer reachable
from the request path.1 parent da10371 commit 38db91f
3 files changed
Lines changed: 57 additions & 293 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
| 9 | + | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
12 | | - | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
126 | 129 | | |
127 | 130 | | |
128 | 131 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
| 132 | + | |
182 | 133 | | |
183 | | - | |
184 | 134 | | |
185 | 135 | | |
186 | 136 | | |
| |||
195 | 145 | | |
196 | 146 | | |
197 | 147 | | |
198 | | - | |
199 | 148 | | |
200 | 149 | | |
201 | 150 | | |
| |||
219 | 168 | | |
220 | 169 | | |
221 | 170 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | 171 | | |
236 | 172 | | |
237 | 173 | | |
| |||
300 | 236 | | |
301 | 237 | | |
302 | 238 | | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
316 | 250 | | |
317 | 251 | | |
318 | 252 | | |
| |||
337 | 271 | | |
338 | 272 | | |
339 | 273 | | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
348 | 277 | | |
349 | 278 | | |
350 | 279 | | |
| |||
398 | 327 | | |
399 | 328 | | |
400 | 329 | | |
401 | | - | |
| 330 | + | |
402 | 331 | | |
403 | 332 | | |
404 | 333 | | |
| |||
409 | 338 | | |
410 | 339 | | |
411 | 340 | | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
| 341 | + | |
433 | 342 | | |
434 | 343 | | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | 344 | | |
471 | 345 | | |
472 | 346 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | | - | |
22 | | - | |
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
| |||
0 commit comments