diff --git a/services/clsi/app/js/CLSICacheHandler.js b/services/clsi/app/js/CLSICacheHandler.js index c9de59d52f..d4697c9977 100644 --- a/services/clsi/app/js/CLSICacheHandler.js +++ b/services/clsi/app/js/CLSICacheHandler.js @@ -115,6 +115,7 @@ function closeCircuitBreaker(url) { * @param {Record} opts.stats * @param {Record} opts.timings * @param {Record} opts.options + * @param {{path:string,method:string}} opts.metricsOpts * @return {string | undefined} */ function notifyCLSICacheAboutBuild({ @@ -127,6 +128,7 @@ function notifyCLSICacheAboutBuild({ stats, timings, options, + metricsOpts, }) { if (!Settings.apis.clsiCache.enabled) return undefined if (!OBJECT_ID_REGEX.test(projectId)) return undefined @@ -192,26 +194,34 @@ function notifyCLSICacheAboutBuild({ }) } - // PDF preview - enqueue( - outputFiles - .filter( - f => - f.path === 'output.pdf' || - f.path === 'output.log' || - f.path === 'output.synctex.gz' - ) - .concat( - outputFiles.filter(f => f.path.endsWith('.blg')).slice(0, MAX_BLG_FILES) - ) - .map(f => { - const lean = { path: f.path } - if (f.path === 'output.pdf') { - Object.assign(lean, _.pick(f, 'path', 'size', 'contentId', 'ranges')) - } - return lean - }) - ) + const isUserCompile = !metricsOpts.path + if (!(isUserCompile && compileGroup === 'standard')) { + // PDF preview, skip for free compiles + enqueue( + outputFiles + .filter( + f => + f.path === 'output.pdf' || + f.path === 'output.log' || + f.path === 'output.synctex.gz' + ) + .concat( + outputFiles + .filter(f => f.path.endsWith('.blg')) + .slice(0, MAX_BLG_FILES) + ) + .map(f => { + const lean = { path: f.path } + if (f.path === 'output.pdf') { + Object.assign( + lean, + _.pick(f, 'path', 'size', 'contentId', 'ranges') + ) + } + return lean + }) + ) + } // Compile Cache buildTarball({ projectId, userId, buildId, outputFiles }) diff --git a/services/clsi/app/js/CompileController.js b/services/clsi/app/js/CompileController.js index ef865e9609..53925c1291 100644 --- a/services/clsi/app/js/CompileController.js +++ b/services/clsi/app/js/CompileController.js @@ -143,6 +143,7 @@ function compile(req, res, next) { rootResourcePath: request.rootResourcePath, stopOnFirstError: request.stopOnFirstError, }, + metricsOpts: request.metricsOpts, }) }