mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
[rails] migrate compiles of conversions/submissions to history mode (#32053)
* [saas-e2e] test gallery templates with binary file * [rails] add make target for fixing rubocop errors * [rails] migrate compiles of conversions/submissions to history mode * [rails] forward version to clsi request * [rails] trim down compile request * [saas-e2e] source v1 secrets after make install GitOrigin-RevId: 65269e1df1051c9f3b4f1813d2e9dcf32a01be50
This commit is contained in:
@@ -107,7 +107,7 @@ async function doCompile(request, stats, timings) {
|
||||
|
||||
let resourceList, baseHistoryVersion
|
||||
try {
|
||||
if (request.historyId) {
|
||||
if (request.rawChangeOperations) {
|
||||
;({ resourceList, baseHistoryVersion } =
|
||||
await HistoryResourceWriter.syncResourcesToDisk(
|
||||
projectId,
|
||||
@@ -849,7 +849,7 @@ function _emitMetrics(request, status, stats, timings) {
|
||||
if (timings.compileE2E != null) {
|
||||
ClsiMetrics.e2eCompileDurationSeconds.observe(
|
||||
{
|
||||
compileFromHistory: !!request.historyId,
|
||||
compileFromHistory: !!request.rawChangeOperations,
|
||||
compile: request.metricsOpts.compile,
|
||||
group: request.compileGroup,
|
||||
},
|
||||
|
||||
@@ -421,7 +421,11 @@ export async function syncResourcesToDisk(
|
||||
)
|
||||
}
|
||||
|
||||
const blobStore = new BlobStore(request.historyId, globalBlobs)
|
||||
const blobStore = new BlobStore(
|
||||
request.historyId,
|
||||
request.filestoreBlobPrefix,
|
||||
globalBlobs
|
||||
)
|
||||
const loadEagerStart = performance.now()
|
||||
await snapshot.loadFiles('eager', blobStore)
|
||||
timings.snapshotLoadEager = Math.ceil(performance.now() - loadEagerStart)
|
||||
@@ -503,13 +507,17 @@ class BlobStore {
|
||||
#historyId
|
||||
/** @type {string[]} */
|
||||
#globalBlobs
|
||||
/** @type {string} */
|
||||
#filestoreBlobPrefix
|
||||
|
||||
/**
|
||||
* @param {string} historyId
|
||||
* @param {string} filestoreBlobPrefix
|
||||
* @param {string[]} globalBlobs
|
||||
*/
|
||||
constructor(historyId, globalBlobs) {
|
||||
constructor(historyId, filestoreBlobPrefix, globalBlobs) {
|
||||
this.#historyId = historyId
|
||||
this.#filestoreBlobPrefix = filestoreBlobPrefix
|
||||
this.#globalBlobs = globalBlobs
|
||||
}
|
||||
|
||||
@@ -519,7 +527,9 @@ class BlobStore {
|
||||
*/
|
||||
getBlobURL(hash) {
|
||||
const u = new URL(Settings.apis.filestore.url)
|
||||
if (this.#globalBlobs.includes(hash)) {
|
||||
if (this.#filestoreBlobPrefix) {
|
||||
u.pathname = `${this.#filestoreBlobPrefix}/${hash}`
|
||||
} else if (this.#globalBlobs.includes(hash)) {
|
||||
u.pathname = `/history/global/hash/${hash}`
|
||||
} else {
|
||||
u.pathname = `/history/project/${this.#historyId}/hash/${hash}`
|
||||
|
||||
@@ -162,6 +162,11 @@ function parse(body, callback) {
|
||||
response.rawSnapshot = compile.rawSnapshot
|
||||
response.rawChangeOperations = compile.rawChangeOperations
|
||||
|
||||
// v1 conversions / submissions
|
||||
if (compile.filestoreBlobPrefix) {
|
||||
response.filestoreBlobPrefix = _checkPath(compile.filestoreBlobPrefix)
|
||||
}
|
||||
|
||||
const rootResourcePath = _parseAttribute(
|
||||
'rootResourcePath',
|
||||
compile.rootResourcePath,
|
||||
|
||||
Reference in New Issue
Block a user