mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #24790 from overleaf/ls-use-script-runner
Update some scripts to use Script Runner GitOrigin-RevId: aaa11f94dcfd328c158bb02d1b9fb2adfb1bb146
This commit is contained in:
@@ -19,6 +19,7 @@ import AccountMappingHelper from '../../app/src/Features/Analytics/AccountMappin
|
||||
import { registerAccountMapping } from '../../app/src/Features/Analytics/AnalyticsManager.js'
|
||||
import { triggerGracefulShutdown } from '../../app/src/infrastructure/GracefulShutdown.js'
|
||||
import Validation from '../../app/src/infrastructure/Validation.js'
|
||||
import { scriptRunner } from '../lib/ScriptRunner.mjs'
|
||||
|
||||
const paramsSchema = Validation.Joi.object({
|
||||
endDate: Validation.Joi.string().isoDate(),
|
||||
@@ -59,7 +60,7 @@ function registerMapping(subscription) {
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
async function main(trackProgress) {
|
||||
const additionalBatchedUpdateOptions = {}
|
||||
|
||||
if (endDate) {
|
||||
@@ -83,6 +84,7 @@ async function main() {
|
||||
{
|
||||
verboseLogging: verbose,
|
||||
...additionalBatchedUpdateOptions,
|
||||
trackProgress,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -109,7 +111,7 @@ if (error) {
|
||||
triggerGracefulShutdown(done => done(1))
|
||||
} else {
|
||||
logger.info({ verbose, commit, endDate }, commit ? 'COMMITTING' : 'DRY RUN')
|
||||
await main()
|
||||
await scriptRunner(main)
|
||||
|
||||
triggerGracefulShutdown({
|
||||
close(done) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import { DeletedSubscription } from '../../app/src/models/DeletedSubscription.js
|
||||
import minimist from 'minimist'
|
||||
import _ from 'lodash'
|
||||
import mongodb from 'mongodb-legacy'
|
||||
import { scriptRunner } from '../lib/ScriptRunner.mjs'
|
||||
|
||||
const { ObjectId } = mongodb
|
||||
|
||||
@@ -272,7 +273,7 @@ const setup = () => {
|
||||
|
||||
setup()
|
||||
try {
|
||||
await main()
|
||||
await scriptRunner(main)
|
||||
console.error('Done.')
|
||||
process.exit(0)
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user