mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-30 12:24:25 +02:00
[clsi] prepare for clsi-cache survey (#29274)
* [clsi] add stats and timings to compile response from clsi-cache * [clsi] set downloadedFromCache when previously downloaded for synctex Assumption: every compile will emit an output.log. When the output.log is missing, but the output.synctex.gz exists, it must have been downloaded from the cache. GitOrigin-RevId: 41ea34880931e3c43dda3bc9eb26c0d02054894d
This commit is contained in:
@@ -42,6 +42,8 @@ function getShard(projectId) {
|
||||
* @param {string} editorId
|
||||
* @param {[{path: string}]} outputFiles
|
||||
* @param {string} compileGroup
|
||||
* @param {Record<string, number>} stats
|
||||
* @param {Record<string, number>} timings
|
||||
* @param {Record<string, any>} options
|
||||
* @return {string | undefined}
|
||||
*/
|
||||
@@ -52,6 +54,8 @@ function notifyCLSICacheAboutBuild({
|
||||
editorId,
|
||||
outputFiles,
|
||||
compileGroup,
|
||||
stats,
|
||||
timings,
|
||||
options,
|
||||
}) {
|
||||
if (!Settings.apis.clsiCache.enabled) return undefined
|
||||
@@ -72,6 +76,8 @@ function notifyCLSICacheAboutBuild({
|
||||
downloadHost: Settings.apis.clsi.downloadHost,
|
||||
clsiServerId: Settings.apis.clsi.clsiServerId,
|
||||
compileGroup,
|
||||
stats,
|
||||
timings,
|
||||
options,
|
||||
})
|
||||
)
|
||||
|
||||
@@ -125,6 +125,8 @@ function compile(req, res, next) {
|
||||
editorId: request.editorId,
|
||||
outputFiles,
|
||||
compileGroup: request.compileGroup,
|
||||
stats,
|
||||
timings,
|
||||
options: {
|
||||
compiler: request.compiler,
|
||||
draft: request.draft,
|
||||
|
||||
@@ -561,6 +561,13 @@ async function _runSynctex(projectId, userId, command, opts) {
|
||||
let downloadedFromCache = false
|
||||
try {
|
||||
await _checkFileExists(directory, 'output.synctex.gz')
|
||||
if (compileFromClsiCache) {
|
||||
try {
|
||||
await _checkFileExists(directory, 'output.log')
|
||||
} catch (err) {
|
||||
if (err instanceof Errors.NotFoundError) downloadedFromCache = true
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
if (
|
||||
err instanceof Errors.NotFoundError &&
|
||||
|
||||
@@ -123,6 +123,8 @@ async function getLatestBuildFromCache(req, res) {
|
||||
clsiServerId,
|
||||
clsiCacheShard,
|
||||
options,
|
||||
stats,
|
||||
timings,
|
||||
} = await ClsiCacheManager.getLatestCompileResult(projectId, userId)
|
||||
|
||||
let { pdfCachingMinChunkSize, pdfDownloadDomain } =
|
||||
@@ -138,6 +140,8 @@ async function getLatestBuildFromCache(req, res) {
|
||||
pdfDownloadDomain,
|
||||
pdfCachingMinChunkSize,
|
||||
options,
|
||||
stats,
|
||||
timings,
|
||||
})
|
||||
} catch (err) {
|
||||
if (err instanceof NotFoundError) {
|
||||
|
||||
@@ -107,7 +107,16 @@ async function tryGetLatestCompileResult(projectId, userId, signal) {
|
||||
const [, editorId, buildId] = metaLocation.match(
|
||||
/\/build\/([a-f0-9-]+?)-([a-f0-9]+-[a-f0-9]+)\//
|
||||
)
|
||||
const { ranges, contentId, clsiServerId, compileGroup, size, options } = meta
|
||||
const {
|
||||
ranges,
|
||||
contentId,
|
||||
clsiServerId,
|
||||
compileGroup,
|
||||
size,
|
||||
options,
|
||||
stats,
|
||||
timings,
|
||||
} = meta
|
||||
|
||||
let baseURL = `/project/${projectId}`
|
||||
if (userId) {
|
||||
@@ -150,6 +159,8 @@ async function tryGetLatestCompileResult(projectId, userId, signal) {
|
||||
clsiServerId,
|
||||
clsiCacheShard,
|
||||
options,
|
||||
stats,
|
||||
timings,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user