Merge pull request #10376 from overleaf/jpa-pdf-caching-disable-first-error

[web] pdf-caching: disable pdf-caching after the first non-404 error

GitOrigin-RevId: f022e75acd9d5140ae02041b60af9819baa25e62
This commit is contained in:
Jakob Ackermann
2022-11-08 14:40:51 +00:00
committed by Copybot
parent d6e2f06885
commit 22d7702b2e

View File

@@ -111,6 +111,13 @@ export function generatePdfCachingTransportFactory(PDFJS) {
.catch(err => {
if (abortSignal.aborted) return
if (isExpectedError(err)) {
if (is404(err)) {
// A regular pdf-js request would have seen this 404 as well.
} else {
// Flaky network, switch back to regular pdf-js requests.
metrics.failedCount++
metrics.failedOnce = true
}
throw new PDFJS.MissingPDFException()
}
metrics.failedCount++