diff --git a/services/web/app/src/Features/Compile/CompileController.mjs b/services/web/app/src/Features/Compile/CompileController.mjs index c4ba3050a8..0f23c340fb 100644 --- a/services/web/app/src/Features/Compile/CompileController.mjs +++ b/services/web/app/src/Features/Compile/CompileController.mjs @@ -44,19 +44,11 @@ function getOutputFilesArchiveSpecification(projectId, userId, buildId) { } } -async function getPdfCachingMinChunkSize(req, res) { - const { variant } = await SplitTestHandler.promises.getAssignment( - req, - res, - 'pdf-caching-min-chunk-size' - ) - if (variant === 'default') { - return 1_000_000 - } - return parseInt(variant, 10) +function getPdfCachingMinChunkSize(req, res) { + return Settings.pdfCachingMinChunkSize } -async function _getSplitTestOptions(req, res) { +function _getSplitTestOptions(req, res) { // Use the query flags from the editor request for overriding the split test. let query = {} try { @@ -66,8 +58,9 @@ async function _getSplitTestOptions(req, res) { const editorReq = { ...req, query } const pdfDownloadDomain = Settings.pdfDownloadDomain + const enablePdfCaching = Settings.enablePdfCaching - if (!req.query.enable_pdf_caching) { + if (!enablePdfCaching || !req.query.enable_pdf_caching) { // The frontend does not want to do pdf caching. return { pdfDownloadDomain, @@ -75,23 +68,7 @@ async function _getSplitTestOptions(req, res) { } } - // Double check with the latest split test assignment. - // We may need to turn off the feature on a short notice, without requiring - // all users to reload their editor page to disable the feature. - const { variant } = await SplitTestHandler.promises.getAssignment( - editorReq, - res, - 'pdf-caching-mode' - ) - const enablePdfCaching = variant === 'enabled' - if (!enablePdfCaching) { - // Skip the lookup of the chunk size when caching is not enabled. - return { - pdfDownloadDomain, - enablePdfCaching: false, - } - } - const pdfCachingMinChunkSize = await getPdfCachingMinChunkSize(editorReq, res) + const pdfCachingMinChunkSize = getPdfCachingMinChunkSize(editorReq, res) return { pdfDownloadDomain, enablePdfCaching, @@ -181,7 +158,7 @@ const _CompileController = { } let { enablePdfCaching, pdfCachingMinChunkSize, pdfDownloadDomain } = - await _getSplitTestOptions(req, res) + _getSplitTestOptions(req, res) if (Features.hasFeature('saas')) { options.compileFromClsiCache = true options.populateClsiCache = true diff --git a/services/web/app/src/Features/Project/ProjectController.mjs b/services/web/app/src/Features/Project/ProjectController.mjs index d45fa8f1e4..9297fe08a9 100644 --- a/services/web/app/src/Features/Project/ProjectController.mjs +++ b/services/web/app/src/Features/Project/ProjectController.mjs @@ -435,8 +435,6 @@ const _ProjectController = { 'visual-preview', 'external-socket-heartbeat', 'null-test-share-modal', - 'pdf-caching-cached-url-lookup', - 'pdf-caching-mode', 'pdf-caching-prefetch-large', 'pdf-caching-prefetching', 'revert-file', diff --git a/services/web/config/settings.defaults.js b/services/web/config/settings.defaults.js index 1aa8a42f68..49fbbbaca1 100644 --- a/services/web/config/settings.defaults.js +++ b/services/web/config/settings.defaults.js @@ -703,6 +703,10 @@ module.exports = { // By default turn on feature flag, can be overridden per request. enablePdfCaching: process.env.ENABLE_PDF_CACHING === 'true', + pdfCachingMinChunkSize: 7500, + pdfCaching: true, + cachedUrlLookupEnabled: true, + // Maximum size of text documents in the real-time editing system. max_doc_length: 2 * 1024 * 1024, // 2mb