mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01: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:
@@ -22,7 +22,14 @@ async function getDoc(req, res) {
|
||||
async function peekDoc(req, res) {
|
||||
const { doc_id: docId, project_id: projectId } = req.params
|
||||
logger.debug({ projectId, docId }, 'peeking doc')
|
||||
const doc = await DocManager.peekDoc(projectId, docId)
|
||||
const doc = await DocManager.peekDoc(projectId, docId, {
|
||||
deleted: true,
|
||||
inS3: true,
|
||||
lines: true,
|
||||
ranges: true,
|
||||
rev: 1,
|
||||
version: true,
|
||||
})
|
||||
res.setHeader('x-doc-status', doc.inS3 ? 'archived' : 'active')
|
||||
res.json(_buildDocView(doc))
|
||||
}
|
||||
@@ -121,7 +128,11 @@ async function getTrackedChangesUserIds(req, res) {
|
||||
|
||||
async function projectHasRanges(req, res) {
|
||||
const { project_id: projectId } = req.params
|
||||
const projectHasRanges = await DocManager.projectHasRanges(projectId)
|
||||
const useSecondary = req.query.useSecondary === 'true'
|
||||
const projectHasRanges = await DocManager.projectHasRanges(
|
||||
projectId,
|
||||
useSecondary
|
||||
)
|
||||
res.json({ projectHasRanges })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user