mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
[history-v1] Disable backups on CE/SP (#25591)
Disables backup when `backupStore` is not present, as it's the case for CE/SP GitOrigin-RevId: a920f041c639e599084fa97d2ef2643a01da70e3
This commit is contained in:
@@ -255,11 +255,13 @@ async function createProjectBlob(req, res, next) {
|
||||
const blobStore = new BlobStore(projectId)
|
||||
const newBlob = await blobStore.putFile(tmpPath)
|
||||
|
||||
try {
|
||||
const { backupBlob } = await import('../../storage/lib/backupBlob.mjs')
|
||||
await backupBlob(projectId, newBlob, tmpPath)
|
||||
} catch (error) {
|
||||
logger.warn({ error, projectId, hash }, 'Failed to backup blob')
|
||||
if (config.has('backupStore')) {
|
||||
try {
|
||||
const { backupBlob } = await import('../../storage/lib/backupBlob.mjs')
|
||||
await backupBlob(projectId, newBlob, tmpPath)
|
||||
} catch (error) {
|
||||
logger.warn({ error, projectId, hash }, 'Failed to backup blob')
|
||||
}
|
||||
}
|
||||
res.status(HTTPStatus.CREATED).end()
|
||||
})
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
const { ObjectId, ReadPreference, MongoError } = require('mongodb')
|
||||
const { Chunk } = require('overleaf-editor-core')
|
||||
const OError = require('@overleaf/o-error')
|
||||
const config = require('config')
|
||||
const assert = require('../assert')
|
||||
const mongodb = require('../mongodb')
|
||||
const { ChunkVersionConflictError } = require('./errors')
|
||||
@@ -259,6 +260,9 @@ async function updateProjectRecord(
|
||||
earliestChangeTimestamp,
|
||||
mongoOpts = {}
|
||||
) {
|
||||
if (!config.has('backupStore')) {
|
||||
return
|
||||
}
|
||||
// record the end version against the project
|
||||
await mongodb.projects.updateOne(
|
||||
{
|
||||
|
||||
@@ -64,6 +64,10 @@ async function clearBucket(name) {
|
||||
let s3PersistorForBackupCleanup
|
||||
|
||||
async function cleanupBackup() {
|
||||
if (!config.has('backupStore')) {
|
||||
return
|
||||
}
|
||||
|
||||
// The backupPersistor refuses to delete short prefixes. Use a low-level S3 persistor.
|
||||
if (!s3PersistorForBackupCleanup) {
|
||||
const { backupPersistor } = await import(
|
||||
|
||||
Reference in New Issue
Block a user