Merge pull request #11624 from overleaf/jpa-hybrid-download-params

[web] add split tests for tweaking user content domain access check

GitOrigin-RevId: a5e6959098c10ea230634492b465c2b9dcdd909f
This commit is contained in:
Jakob Ackermann 2023-02-02 11:58:41 +00:00 committed by Copybot
parent 635f2969ba
commit e63b90d288
5 changed files with 48 additions and 9 deletions

View file

@ -1081,6 +1081,28 @@ const ProjectController = {
}
)
},
userContentDomainAccessCheckDelayAssigment(cb) {
SplitTestHandler.getAssignment(
req,
res,
'user-content-domain-access-check-delay',
() => {
// We'll pick up the assignment from the res.locals assignment.
cb()
}
)
},
userContentDomainAccessCheckMaxChecksAssigment(cb) {
SplitTestHandler.getAssignment(
req,
res,
'user-content-domain-access-check-max-checks',
() => {
// We'll pick up the assignment from the res.locals assignment.
cb()
}
)
},
reportUserContentDomainAccessCheckErrorAssigment(cb) {
SplitTestHandler.getAssignment(
req,

View file

@ -8,10 +8,19 @@ import getMeta from '../../utils/meta'
import OError from '@overleaf/o-error'
import { captureException } from '../../infrastructure/error-reporter'
import { postJSON } from '../../infrastructure/fetch-json'
import isSplitTestEnabled from '../../utils/isSplitTestEnabled'
import {
isSplitTestEnabled,
parseIntFromSplitTest,
} from '../../utils/splitTestUtils'
const MAX_CHECKS_PER_PAGE_LOAD = 3
const INITIAL_DELAY_MS = 30_000
const MAX_CHECKS_PER_PAGE_LOAD = parseIntFromSplitTest(
'user-content-domain-access-check-max-checks',
3
)
const INITIAL_DELAY_MS = parseIntFromSplitTest(
'user-content-domain-access-check-delay',
30_000
)
const DELAY_BETWEEN_PROBES_MS = 1_000
const TIMEOUT_MS = 30_000
const FULL_SIZE = 739

View file

@ -70,7 +70,6 @@ import { cleanupServiceWorker } from './utils/service-worker-cleanup'
import { reportCM6Perf } from './infrastructure/cm6-performance'
import { reportAcePerf } from './ide/editor/ace-performance'
import { scheduleUserContentDomainAccessCheck } from './features/user-content-domain-access-check'
import isSplitTestEnabled from './utils/isSplitTestEnabled'
App.controller(
'IdeController',

View file

@ -1,5 +0,0 @@
import getMeta from './meta'
export default function isSplitTestEnabled(name: string) {
return getMeta('ol-splitTestVariants')?.[name] === 'enabled'
}

View file

@ -0,0 +1,14 @@
import getMeta from './meta'
export function isSplitTestEnabled(name: string) {
return getMeta('ol-splitTestVariants')?.[name] === 'enabled'
}
export function parseIntFromSplitTest(name: string, defaultValue: number) {
const v = getMeta('ol-splitTestVariants')?.[name]
const n = parseInt(v, 10)
if (v === 'default' || Number.isNaN(n)) {
return defaultValue
}
return n
}