mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
[web] resync_projects: use the secondaries for all reads (#33684)
* [docstore] add useSecondary flag to projectHasRanges The rev-check for unarchiving always consults with the primary. Two extra changes: - Add a projection argument to peekDoc in order to skip lines download from projectHasRanges. - Add one retry to peekDoc to reduce chances of surfacing a rev-check violation. * [web] resync_projects: use the secondaries for all reads * [web] add default value for useSecondary * [docstore] add default value for useSecondary * [k8s] docstore: set MONGO_HAS_SECONDARIES=true GitOrigin-RevId: f15ec4fdc1cabe74c1eab87bec85f28d6f7a587d
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
import minimist from 'minimist'
|
||||
import { scriptRunner } from '../lib/ScriptRunner.mjs'
|
||||
import logger from '@overleaf/logger'
|
||||
import ProjectGetter from '../../app/src/Features/Project/ProjectGetter.mjs'
|
||||
import {
|
||||
db,
|
||||
ObjectId,
|
||||
@@ -268,7 +267,7 @@ async function hasHistoryMetadata(projectId) {
|
||||
if (await hasLinkedFileData(projectId)) {
|
||||
return true
|
||||
}
|
||||
if (await DocstoreManager.promises.projectHasRanges(projectId)) {
|
||||
if (await DocstoreManager.promises.projectHasRanges(projectId, true)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -296,10 +295,11 @@ async function hasHistoryMetadata(projectId) {
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
async function hasLinkedFileData(projectId) {
|
||||
const project = await ProjectGetter.promises.getProjectWithoutLock(
|
||||
projectId,
|
||||
const project = await db.projects.findOne(
|
||||
{ _id: new ObjectId(projectId) },
|
||||
{
|
||||
rootFolder: 1,
|
||||
projection: { rootFolder: 1 },
|
||||
readPreference: READ_PREFERENCE_SECONDARY,
|
||||
}
|
||||
)
|
||||
if (!project) {
|
||||
|
||||
Reference in New Issue
Block a user