mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
[web] Remove split-tests compile-backend-class* and compile-timeout-20s* (#17700)
* 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
This commit is contained in:
@@ -105,15 +105,6 @@ module.exports = CompileController = {
|
||||
stopOnFirstError,
|
||||
}
|
||||
|
||||
// temporary override to force the new compile timeout
|
||||
const forceNewCompileTimeout = req.query.force_new_compile_timeout
|
||||
if (
|
||||
forceNewCompileTimeout === 'active' ||
|
||||
forceNewCompileTimeout === 'changing'
|
||||
) {
|
||||
options.forceNewCompileTimeout = forceNewCompileTimeout
|
||||
}
|
||||
|
||||
if (req.body.rootDoc_id) {
|
||||
options.rootDoc_id = req.body.rootDoc_id
|
||||
} else if (
|
||||
|
||||
@@ -8,18 +8,9 @@ const UserGetter = require('../User/UserGetter')
|
||||
const ClsiManager = require('./ClsiManager')
|
||||
const Metrics = require('@overleaf/metrics')
|
||||
const { RateLimiter } = require('../../infrastructure/RateLimiter')
|
||||
const SplitTestHandler = require('../SplitTests/SplitTestHandler')
|
||||
const UserAnalyticsIdCache = require('../Analytics/UserAnalyticsIdCache')
|
||||
|
||||
const NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF = new Date('2023-09-18T11:00:00.000Z')
|
||||
const NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF_DEFAULT_BASELINE = new Date(
|
||||
'2023-10-10T11:00:00.000Z'
|
||||
)
|
||||
|
||||
module.exports = CompileManager = {
|
||||
NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF,
|
||||
NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF_DEFAULT_BASELINE,
|
||||
|
||||
compile(projectId, userId, options = {}, _callback) {
|
||||
const timer = new Metrics.Timer('editor.compile')
|
||||
const callback = function (...args) {
|
||||
@@ -62,16 +53,6 @@ module.exports = CompileManager = {
|
||||
const value = limits[key]
|
||||
options[key] = value
|
||||
}
|
||||
if (options.timeout !== 20) {
|
||||
// temporary override to force the new compile timeout
|
||||
if (options.forceNewCompileTimeout === 'active') {
|
||||
options.timeout = 20
|
||||
} else if (
|
||||
options.forceNewCompileTimeout === 'changing'
|
||||
) {
|
||||
options.timeout = 60
|
||||
}
|
||||
}
|
||||
// Put a lower limit on autocompiles for free users, based on compileGroup
|
||||
CompileManager._checkCompileGroupAutoCompileLimit(
|
||||
options.isAutoCompile,
|
||||
@@ -184,78 +165,25 @@ module.exports = CompileManager = {
|
||||
if (err) {
|
||||
return callback(err)
|
||||
}
|
||||
const compileGroup =
|
||||
ownerFeatures.compileGroup ||
|
||||
Settings.defaultFeatures.compileGroup
|
||||
const compileTimeout =
|
||||
ownerFeatures.compileTimeout ||
|
||||
Settings.defaultFeatures.compileTimeout
|
||||
|
||||
const limits = {
|
||||
timeout:
|
||||
ownerFeatures.compileTimeout ||
|
||||
Settings.defaultFeatures.compileTimeout,
|
||||
compileGroup:
|
||||
ownerFeatures.compileGroup ||
|
||||
Settings.defaultFeatures.compileGroup,
|
||||
// temporary override until users' compileTimeout is migrated
|
||||
compileGroup === 'standard' && compileTimeout <= 60
|
||||
? 20
|
||||
: compileTimeout,
|
||||
compileGroup,
|
||||
compileBackendClass:
|
||||
compileGroup === 'standard' ? 'n2d' : 'c2d',
|
||||
ownerAnalyticsId: analyticsId,
|
||||
}
|
||||
CompileManager._getCompileBackendClassDetails(
|
||||
owner,
|
||||
limits.compileGroup,
|
||||
(
|
||||
err,
|
||||
{ compileBackendClass, showFasterCompilesFeedbackUI }
|
||||
) => {
|
||||
if (err) return callback(err)
|
||||
limits.compileBackendClass = compileBackendClass
|
||||
limits.showFasterCompilesFeedbackUI =
|
||||
showFasterCompilesFeedbackUI
|
||||
if (compileBackendClass === 'n2d' && limits.timeout <= 60) {
|
||||
// project owners with faster compiles but with <= 60 compile timeout (default)
|
||||
// will have a 20s compile timeout
|
||||
// The compile-timeout-20s split test exists to enable a gradual rollout
|
||||
SplitTestHandler.getAssignmentForMongoUser(
|
||||
owner,
|
||||
'compile-timeout-20s',
|
||||
(err, assignment) => {
|
||||
if (err) return callback(err)
|
||||
// users who were on the 'default' servers at time of original rollout
|
||||
// will have a later cutoff date for the 20s timeout in the next phase
|
||||
// we check the backend class at version 8 (baseline)
|
||||
const backendClassHistory =
|
||||
owner.splitTests?.['compile-backend-class-n2d'] ||
|
||||
[]
|
||||
const backendClassBaselineVariant =
|
||||
backendClassHistory.find(version => {
|
||||
return version.versionNumber === 8
|
||||
})?.variantName
|
||||
const timeoutEnforcedCutoff =
|
||||
backendClassBaselineVariant === 'default'
|
||||
? NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF_DEFAULT_BASELINE
|
||||
: NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF
|
||||
if (assignment?.variant === '20s') {
|
||||
if (owner.signUpDate > timeoutEnforcedCutoff) {
|
||||
limits.timeout = 20
|
||||
callback(null, limits)
|
||||
} else {
|
||||
SplitTestHandler.getAssignmentForMongoUser(
|
||||
owner,
|
||||
'compile-timeout-20s-existing-users',
|
||||
(err, assignmentExistingUsers) => {
|
||||
if (err) return callback(err)
|
||||
if (
|
||||
assignmentExistingUsers?.variant === '20s'
|
||||
) {
|
||||
limits.timeout = 20
|
||||
}
|
||||
callback(null, limits)
|
||||
}
|
||||
)
|
||||
}
|
||||
} else {
|
||||
callback(null, limits)
|
||||
}
|
||||
}
|
||||
)
|
||||
} else {
|
||||
callback(null, limits)
|
||||
}
|
||||
}
|
||||
)
|
||||
callback(null, limits)
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -322,39 +250,6 @@ module.exports = CompileManager = {
|
||||
})
|
||||
},
|
||||
|
||||
_getCompileBackendClassDetails(owner, compileGroup, callback) {
|
||||
const { defaultBackendClass } = Settings.apis.clsi
|
||||
if (compileGroup === 'standard') {
|
||||
return SplitTestHandler.getAssignmentForMongoUser(
|
||||
owner,
|
||||
'compile-backend-class-n2d',
|
||||
(err, assignment) => {
|
||||
if (err) return callback(err, {})
|
||||
const { variant } = assignment
|
||||
callback(null, {
|
||||
compileBackendClass:
|
||||
variant === 'default' ? defaultBackendClass : variant,
|
||||
showFasterCompilesFeedbackUI: false,
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
SplitTestHandler.getAssignmentForMongoUser(
|
||||
owner,
|
||||
'compile-backend-class',
|
||||
(err, assignment) => {
|
||||
if (err) return callback(err, {})
|
||||
const { analytics, variant } = assignment
|
||||
const activeForUser = analytics?.segmentation?.splitTest != null
|
||||
callback(null, {
|
||||
compileBackendClass:
|
||||
variant === 'default' ? defaultBackendClass : variant,
|
||||
showFasterCompilesFeedbackUI: activeForUser,
|
||||
})
|
||||
}
|
||||
)
|
||||
},
|
||||
|
||||
wordCount(projectId, userId, file, clsiserverid, callback) {
|
||||
CompileManager.getProjectCompileLimits(projectId, function (error, limits) {
|
||||
if (error) {
|
||||
|
||||
@@ -13,12 +13,6 @@ const Errors = require('../Errors/Errors')
|
||||
const DocstoreManager = require('../Docstore/DocstoreManager')
|
||||
const logger = require('@overleaf/logger')
|
||||
const { expressify } = require('@overleaf/promise-utils')
|
||||
const SplitTestHandler = require('../SplitTests/SplitTestHandler')
|
||||
const {
|
||||
NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF,
|
||||
NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF_DEFAULT_BASELINE,
|
||||
} = require('../Compile/CompileManager')
|
||||
const UserGetter = require('../User/UserGetter')
|
||||
|
||||
module.exports = {
|
||||
joinProject: expressify(joinProject),
|
||||
@@ -72,58 +66,6 @@ async function joinProject(req, res, next) {
|
||||
if (!project) {
|
||||
return res.sendStatus(403)
|
||||
}
|
||||
// Compile timeout 20s test
|
||||
if (project.features?.compileTimeout <= 60) {
|
||||
const compileAssignment =
|
||||
await SplitTestHandler.promises.getAssignmentForUser(
|
||||
project.owner._id,
|
||||
'compile-backend-class-n2d'
|
||||
)
|
||||
if (compileAssignment?.variant === 'n2d') {
|
||||
const timeoutAssignment =
|
||||
await SplitTestHandler.promises.getAssignmentForUser(
|
||||
project.owner._id,
|
||||
'compile-timeout-20s'
|
||||
)
|
||||
if (timeoutAssignment?.variant === '20s') {
|
||||
// users who were on the 'default' servers at time of original rollout
|
||||
// will have a later cutoff date for the 20s timeout in the next phase
|
||||
// we check the backend class at version 8 (baseline)
|
||||
const owner = await UserGetter.promises.getUser(project.owner._id, {
|
||||
_id: 1,
|
||||
'splitTests.compile-backend-class-n2d': 1,
|
||||
})
|
||||
const backendClassHistory =
|
||||
owner.splitTests?.['compile-backend-class-n2d'] || []
|
||||
const backendClassBaselineVariant = backendClassHistory.find(
|
||||
version => {
|
||||
return version.versionNumber === 8
|
||||
}
|
||||
)?.variantName
|
||||
const timeoutEnforcedCutoff =
|
||||
backendClassBaselineVariant === 'default'
|
||||
? NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF_DEFAULT_BASELINE
|
||||
: NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF
|
||||
if (project.owner.signUpDate > timeoutEnforcedCutoff) {
|
||||
// New users will see a 10s warning and compile fail at 20s
|
||||
project.showNewCompileTimeoutUI = 'active'
|
||||
} else {
|
||||
const existingUserTimeoutAssignment =
|
||||
await SplitTestHandler.promises.getAssignmentForUser(
|
||||
project.owner._id,
|
||||
'compile-timeout-20s-existing-users'
|
||||
)
|
||||
if (existingUserTimeoutAssignment?.variant === '20s') {
|
||||
// Older users in treatment see 10s warning and compile fail at 20s
|
||||
project.showNewCompileTimeoutUI = 'active'
|
||||
} else {
|
||||
// Older users in control aren't limited to 20s, but will see a notice of upcoming changes if compile >20s
|
||||
project.showNewCompileTimeoutUI = 'changing'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Hide sensitive data if the user is restricted
|
||||
if (isRestrictedUser) {
|
||||
project.owner = { _id: project.owner._id }
|
||||
|
||||
Reference in New Issue
Block a user