Files
overleaf-cep/services/document-updater/scripts/flush_all.js
Jakob Ackermann b0b9733a42 [document-updater] migrate ProjectFlusher to async/await (#28796)
GitOrigin-RevId: 24f61d6c0fab5d65b962cc7031ce0b8c84d5a915
2025-10-09 08:07:31 +00:00

47 lines
1.2 KiB
JavaScript

const ProjectFlusher = require('../app/js/ProjectFlusher')
const minimist = require('minimist')
async function main() {
const argv = minimist(process.argv.slice(2), {
default: {
limit: 100000,
concurrency: 5,
'dry-run': false,
},
boolean: ['dry-run', 'help'],
alias: { h: 'help', n: 'dry-run', j: 'concurrency' },
})
if (argv.help) {
console.log(`
Usage: node scripts/flush_all.js [options]
Options:
--limit Number of projects to flush (default: 100000)
--concurrency, -j Number of concurrent flush operations (default: 5)
--dryRun, -n Perform a dry run without making any changes (default: false)
--help, -h Show this help message
`)
process.exit(0)
}
const options = {
limit: argv.limit,
concurrency: argv.concurrency,
dryRun: argv['dry-run'],
}
console.log('Flushing all projects with options:', options)
await ProjectFlusher.promises.flushAllProjects(options)
}
main()
.then(() => {
console.log('Done flushing all projects')
process.exit(0)
})
.catch(error => {
console.error('There was an error flushing all projects', { error })
process.exit(1)
})