mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-05-17 06:06:35 +00:00
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.