mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
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:
parent
635f2969ba
commit
e63b90d288
5 changed files with 48 additions and 9 deletions
|
@ -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) {
|
reportUserContentDomainAccessCheckErrorAssigment(cb) {
|
||||||
SplitTestHandler.getAssignment(
|
SplitTestHandler.getAssignment(
|
||||||
req,
|
req,
|
||||||
|
|
|
@ -8,10 +8,19 @@ import getMeta from '../../utils/meta'
|
||||||
import OError from '@overleaf/o-error'
|
import OError from '@overleaf/o-error'
|
||||||
import { captureException } from '../../infrastructure/error-reporter'
|
import { captureException } from '../../infrastructure/error-reporter'
|
||||||
import { postJSON } from '../../infrastructure/fetch-json'
|
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 MAX_CHECKS_PER_PAGE_LOAD = parseIntFromSplitTest(
|
||||||
const INITIAL_DELAY_MS = 30_000
|
'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 DELAY_BETWEEN_PROBES_MS = 1_000
|
||||||
const TIMEOUT_MS = 30_000
|
const TIMEOUT_MS = 30_000
|
||||||
const FULL_SIZE = 739
|
const FULL_SIZE = 739
|
||||||
|
|
|
@ -70,7 +70,6 @@ import { cleanupServiceWorker } from './utils/service-worker-cleanup'
|
||||||
import { reportCM6Perf } from './infrastructure/cm6-performance'
|
import { reportCM6Perf } from './infrastructure/cm6-performance'
|
||||||
import { reportAcePerf } from './ide/editor/ace-performance'
|
import { reportAcePerf } from './ide/editor/ace-performance'
|
||||||
import { scheduleUserContentDomainAccessCheck } from './features/user-content-domain-access-check'
|
import { scheduleUserContentDomainAccessCheck } from './features/user-content-domain-access-check'
|
||||||
import isSplitTestEnabled from './utils/isSplitTestEnabled'
|
|
||||||
|
|
||||||
App.controller(
|
App.controller(
|
||||||
'IdeController',
|
'IdeController',
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
import getMeta from './meta'
|
|
||||||
|
|
||||||
export default function isSplitTestEnabled(name: string) {
|
|
||||||
return getMeta('ol-splitTestVariants')?.[name] === 'enabled'
|
|
||||||
}
|
|
14
services/web/frontend/js/utils/splitTestUtils.ts
Normal file
14
services/web/frontend/js/utils/splitTestUtils.ts
Normal 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
|
||||||
|
}
|
Loading…
Reference in a new issue