mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
[clsi] reduce write traffic to clsi-cache from free users (#32958)
GitOrigin-RevId: c01cc21c3c82f361c7d82843e65bb087b21434ed
This commit is contained in:
@@ -115,6 +115,7 @@ function closeCircuitBreaker(url) {
|
||||
* @param {Record<string, number>} opts.stats
|
||||
* @param {Record<string, number>} opts.timings
|
||||
* @param {Record<string, any>} 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 })
|
||||
|
||||
@@ -143,6 +143,7 @@ function compile(req, res, next) {
|
||||
rootResourcePath: request.rootResourcePath,
|
||||
stopOnFirstError: request.stopOnFirstError,
|
||||
},
|
||||
metricsOpts: request.metricsOpts,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user