mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #20679 from overleaf/bg-issue19022
Move flush_all_projects endpoint in document-updater into script GitOrigin-RevId: cb774d860b5928b7fece1a8e21b0b76aecae73ff
This commit is contained in:
@@ -1,12 +1,38 @@
|
||||
const ProjectFlusher = require('../app/js/ProjectFlusher')
|
||||
const minimist = require('minimist')
|
||||
|
||||
async function main() {
|
||||
console.log('Flushing all projects')
|
||||
return await new Promise((resolve, reject) => {
|
||||
const options = {
|
||||
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)
|
||||
|
||||
return await new Promise((resolve, reject) => {
|
||||
ProjectFlusher.flushAllProjects(options, err => {
|
||||
if (err) {
|
||||
reject(err)
|
||||
|
||||
Reference in New Issue
Block a user