Merge pull request #10156 from overleaf/jpa-web-disable-prefetch

[web] pdf-caching: double down on disabling of prefetching

GitOrigin-RevId: 60ccea883786bad306a747b5a182982bc648bbbd
This commit is contained in:
Jakob Ackermann 2022-10-25 16:39:26 +01:00 committed by Copybot
parent 07ac37e382
commit a0c180d133
2 changed files with 3 additions and 2 deletions

View file

@ -4,7 +4,7 @@ import { trackPdfDownloadEnabled } from './pdf-caching-flags'
// VERSION should get incremented when making changes to caching behavior or // VERSION should get incremented when making changes to caching behavior or
// adjusting metrics collection. // adjusting metrics collection.
const VERSION = 7 const VERSION = 8
// editing session id // editing session id
const EDITOR_SESSION_ID = uuid() const EDITOR_SESSION_ID = uuid()

View file

@ -648,7 +648,8 @@ export async function fetchRange({
preprocessFileOnce({ file, usageScore, cachedUrls }) preprocessFileOnce({ file, usageScore, cachedUrls })
const startXRefTableRange = const startXRefTableRange =
Math.floor(file.startXRefTable / PDF_JS_CHUNK_SIZE) * PDF_JS_CHUNK_SIZE Math.floor(file.startXRefTable / PDF_JS_CHUNK_SIZE) * PDF_JS_CHUNK_SIZE
const prefetchXRefTable = startXRefTableRange > 0 && start === 0 const prefetchXRefTable =
prefetchingEnabled && startXRefTableRange > 0 && start === 0
const prefetched = getMatchingChunks(file.prefetched, start, end) const prefetched = getMatchingChunks(file.prefetched, start, end)
// Check that handling the range request won't trigger excessive sub-requests, // Check that handling the range request won't trigger excessive sub-requests,