mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 18:33:37 -05:00
2dd10c7fee
* Remove split-tests of `compile-timeout-20s` and `compile-timeout-20s-existing-users` * Remove `NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF` variables * Revert timeout override `60` -> `20` * Update settings.overrides.saas.js: `compileTimeout: 20` * Remove `compile-backend-class-n2d` * Remove `force_new_compile_timeout` * Remove `showNewCompileTimeoutUI` * Remove `compileTimeChanging` * Simplify code by removing segmentation object * Remove `CompileTimeoutChangingSoon` * Remove `user.features.compileTimeout = '20 (with 10s prompt)'` * Remove `CompileTimeWarning` * Remove `TimeoutUpgradePrompt` (old) * Remove `compile-backend-class` * Remove unused translations * Update tests * Fix: Show `CompileTimeout` even if `!window.ExposedSettings.enableSubscriptions` * Create script to migrate users to 20s compileTimeout * migration script: exclude `compileTimeout: 20` from the match * migration script: use `batchedUpdate` * Remove `showFasterCompilesFeedbackUI` and `FasterCompilesFeedback` Helped-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Remove `_getCompileBackendClassDetails`, simplify definition of `limits` object * Remove `Settings.apis.clsi.defaultBackendClass` * Remove unnecessary second scan of the whole user collection in dry mode * Override `timeout` to 20 for users having `compileGroup === 'standard' && compileTimeout <= 60` * Remove second `logCount`: re-run the script in dry-mode if you want to see that count * Use secondary readPreference when counting users * Fix script setup and exit 0 * Fix: Remove `user.` from query path! * Add acceptance test on script migration_compile_timeout_60s_to_20s.js GitOrigin-RevId: 3cb65130e6d7fbd9c54005f4c213066d0473e9d8
57 lines
1.4 KiB
JavaScript
57 lines
1.4 KiB
JavaScript
#!/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))
|