mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-02 20:37:21 +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
|
// only when it has changed since the last run. When the network is unavailable
|
||||||
// a previously cached copy is reused if present.
|
// a previously cached copy is reused if present.
|
||||||
async function refreshIndex() {
|
async function refreshIndex() {
|
||||||
const hasCached = fs.existsSync(indexPath);
|
|
||||||
|
|
||||||
if (values["no-download"]) {
|
if (values["no-download"]) {
|
||||||
return; // Freshness check disabled; the read below validates existence.
|
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
|
// On any download failure, fall back to a previously cached copy when one
|
||||||
// exists; otherwise there's nothing to search, so fail.
|
// exists; otherwise there's nothing to search, so fail.
|
||||||
const fallbackOrFail = reason => {
|
const fallbackOrFail = reason => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user