Merge pull request #17960 from overleaf/em-force-resync-hard

Make the force_resync.js script do hard resyncs

GitOrigin-RevId: 8244881828238a92ad9429f01c4975c52f5895d7
This commit is contained in:
Eric Mc Sween 2024-04-19 11:56:00 -04:00 committed by Copybot
parent 36ad15c405
commit 1cd4768ae8

View file

@ -77,7 +77,7 @@ function checkAndClear(project, callback) {
function startResync(cb) { function startResync(cb) {
if (force) { if (force) {
console.log('2. starting resync for', projectId) console.log('2. starting resync for', projectId)
SyncManager.startResync(projectId, err => { SyncManager.startHardResync(projectId, err => {
if (err) { if (err) {
console.log('ERR', JSON.stringify(err.message)) console.log('ERR', JSON.stringify(err.message))
return cb(err) return cb(err)
@ -195,17 +195,8 @@ function checkAndClear(project, callback) {
) )
} }
// find all the broken projects from the failure records
const errorsToResync = [
'Error: history store a non-success status code: 422',
'OError: history store a non-success status code: 422',
'OpsOutOfOrderError: project structure version out of order',
]
async function main() { async function main() {
const results = await db.projectHistoryFailures const results = await db.projectHistoryFailures.find().toArray()
.find({ error: { $in: errorsToResync } })
.toArray()
console.log('number of queues without history store 442 =', results.length) console.log('number of queues without history store 442 =', results.length)
// now check if the project is truly deleted in mongo // now check if the project is truly deleted in mongo