mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01: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:
@@ -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'
|
|
||||||
}
|
|
||||||
@@ -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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user