[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:
@@ -323,10 +323,12 @@ async function updateDoc(
|
||||
* Asks docstore whether any doc in the project has ranges
|
||||
*
|
||||
* @param {string} projectId
|
||||
* @param {boolean} useSecondary
|
||||
*/
|
||||
async function projectHasRanges(projectId) {
|
||||
async function projectHasRanges(projectId, useSecondary = false) {
|
||||
const url = new URL(settings.apis.docstore.url)
|
||||
url.pathname = path.posix.join('project', projectId, 'has-ranges')
|
||||
if (useSecondary) url.searchParams.set('useSecondary', 'true')
|
||||
try {
|
||||
const body = await fetchJson(url, { signal: AbortSignal.timeout(TIMEOUT) })
|
||||
return body.projectHasRanges
|
||||
|
||||
Reference in New Issue
Block a user