mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-25 08:27:19 +02:00
Skip the cache existence check when --no-download is set
Move the `fs.existsSync(indexPath)` check below the `--no-download` early return: in that mode the check is unused (the read after refreshIndex already validates existence), so it's wasted disk I/O.
This commit is contained in:
parent
c7dc7d7dd0
commit
e6c7ab5425
4
external/ccov/coverage_search.mjs
vendored
4
external/ccov/coverage_search.mjs
vendored
@ -89,12 +89,12 @@ const etagPath = `${indexPath}.etag`;
|
||||
// only when it has changed since the last run. When the network is unavailable
|
||||
// a previously cached copy is reused if present.
|
||||
async function refreshIndex() {
|
||||
const hasCached = fs.existsSync(indexPath);
|
||||
|
||||
if (values["no-download"]) {
|
||||
return; // Freshness check disabled; the read below validates existence.
|
||||
}
|
||||
|
||||
const hasCached = fs.existsSync(indexPath);
|
||||
|
||||
// On any download failure, fall back to a previously cached copy when one
|
||||
// exists; otherwise there's nothing to search, so fail.
|
||||
const fallbackOrFail = reason => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user