Merge pull request #19329 from overleaf/em-migration-progress-logs

Log progress during history migration

GitOrigin-RevId: a3af8722b40af2b0ffe9603b6d6dcea02cee833d
This commit is contained in:
Eric Mc Sween 2024-07-09 08:47:45 -04:00 committed by Copybot
parent e47a790af9
commit f63de6779d

View file

@ -80,12 +80,17 @@ async function migrateProjects(opts = {}) {
process.on('SIGINT', handleSignal)
process.on('SIGTERM', handleSignal)
let projectsProcessed = 0
const projectsProcessed = {
quick: 0,
skipped: 0,
resync: 0,
total: 0,
}
const jobsByProjectId = new Map()
let errors = 0
for await (const project of projects) {
if (projectsProcessed >= maxCount) {
if (projectsProcessed.total >= maxCount) {
break
}
@ -119,8 +124,9 @@ async function migrateProjects(opts = {}) {
const job = processProject(projectId, direction, quickOnly)
.then(info => {
jobsByProjectId.delete(projectId)
projectsProcessed += 1
logger.info(
projectsProcessed[info.migrationType] += 1
projectsProcessed.total += 1
logger.debug(
{
projectId,
direction,
@ -130,6 +136,12 @@ async function migrateProjects(opts = {}) {
},
'History ranges support migration'
)
if (projectsProcessed.total % 10000 === 0) {
logger.info(
{ projectsProcessed, errors, lastProjectId: projectId },
'History ranges support migration progress'
)
}
})
.catch(err => {
jobsByProjectId.delete(projectId)