mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #17899 from overleaf/revert-17700-ac-tear-down-compile-timeout-tests
Revert "[web] Remove split-tests `compile-backend-class*` and `compile-timeout-20s*`" GitOrigin-RevId: d5070ced06adbd435e782a44b7ef767e395bd6a0
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const minimist = require('minimist')
|
||||
const {
|
||||
db,
|
||||
READ_PREFERENCE_SECONDARY,
|
||||
waitForDb,
|
||||
} = require('../app/src/infrastructure/mongodb')
|
||||
const { batchedUpdate } = require('./helpers/batchedUpdate')
|
||||
|
||||
async function logCount() {
|
||||
const count60s = await db.users.countDocuments(
|
||||
{ 'features.compileTimeout': { $lte: 60, $ne: 20 } },
|
||||
{ readPreference: READ_PREFERENCE_SECONDARY }
|
||||
)
|
||||
const count20s = await db.users.countDocuments(
|
||||
{ 'features.compileTimeout': 20 },
|
||||
{ readPreference: READ_PREFERENCE_SECONDARY }
|
||||
)
|
||||
console.log(`Found ${count60s} users with compileTimeout <= 60s && != 20s`)
|
||||
console.log(`Found ${count20s} users with compileTimeout == 20s`)
|
||||
}
|
||||
|
||||
const main = async ({ COMMIT }) => {
|
||||
console.time('Script Duration')
|
||||
|
||||
await waitForDb()
|
||||
|
||||
await logCount()
|
||||
|
||||
if (COMMIT) {
|
||||
const nModified = await batchedUpdate(
|
||||
'users',
|
||||
{ 'features.compileTimeout': { $lte: 60, $ne: 20 } },
|
||||
{ $set: { 'features.compileTimeout': 20 } }
|
||||
)
|
||||
console.log(`Updated ${nModified} records`)
|
||||
}
|
||||
|
||||
console.timeEnd('Script Duration')
|
||||
}
|
||||
|
||||
const setup = () => {
|
||||
const argv = minimist(process.argv.slice(2))
|
||||
const COMMIT = argv.commit !== undefined
|
||||
if (!COMMIT) {
|
||||
console.warn('Doing dry run. Add --commit to commit changes')
|
||||
}
|
||||
return { COMMIT }
|
||||
}
|
||||
|
||||
main(setup())
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
process.exit(1)
|
||||
})
|
||||
.then(() => process.exit(0))
|
||||
Reference in New Issue
Block a user