[web] add clsi-cache prompts (#29281)
* [web] add clsi-cache prompts * [web] add new editor variant to segmentation * [web] add tests for useNewEditorVariant * [web] adjust start of using clsi-cache in split-test GitOrigin-RevId: c9c5b1eff2ceefb65ef82516d9074cb971cb4c48
This commit is contained in:
@@ -74,8 +74,9 @@ async function _getSplitTestOptions(req, res) {
|
||||
'populate-clsi-cache'
|
||||
)
|
||||
let populateClsiCache = populateClsiCacheVariant === 'enabled'
|
||||
const compileFromClsiCache = populateClsiCache // use same split-test
|
||||
let compileFromClsiCache = populateClsiCache // use same split-test
|
||||
|
||||
let clsiCachePromptVariant = 'default'
|
||||
if (!populateClsiCache) {
|
||||
// Pre-populate the cache for the users in the split-test for prompts.
|
||||
// Keep the compile from cache disabled for now.
|
||||
@@ -84,7 +85,17 @@ async function _getSplitTestOptions(req, res) {
|
||||
res,
|
||||
'populate-clsi-cache-for-prompt'
|
||||
)
|
||||
;({ variant: clsiCachePromptVariant } =
|
||||
await SplitTestHandler.promises.getAssignment(
|
||||
editorReq,
|
||||
res,
|
||||
'clsi-cache-prompt'
|
||||
))
|
||||
populateClsiCache = variant === 'enabled'
|
||||
if (res.locals.splitTestInfo?.['clsi-cache-prompt']?.active) {
|
||||
// Start using the cache when the split-test for the prompts is activated.
|
||||
compileFromClsiCache = populateClsiCache
|
||||
}
|
||||
}
|
||||
|
||||
const pdfDownloadDomain = Settings.pdfDownloadDomain
|
||||
@@ -94,6 +105,7 @@ async function _getSplitTestOptions(req, res) {
|
||||
return {
|
||||
compileFromClsiCache,
|
||||
populateClsiCache,
|
||||
clsiCachePromptVariant,
|
||||
pdfDownloadDomain,
|
||||
enablePdfCaching: false,
|
||||
}
|
||||
@@ -113,6 +125,7 @@ async function _getSplitTestOptions(req, res) {
|
||||
return {
|
||||
compileFromClsiCache,
|
||||
populateClsiCache,
|
||||
clsiCachePromptVariant,
|
||||
pdfDownloadDomain,
|
||||
enablePdfCaching: false,
|
||||
}
|
||||
@@ -121,6 +134,7 @@ async function _getSplitTestOptions(req, res) {
|
||||
return {
|
||||
compileFromClsiCache,
|
||||
populateClsiCache,
|
||||
clsiCachePromptVariant,
|
||||
pdfDownloadDomain,
|
||||
enablePdfCaching,
|
||||
pdfCachingMinChunkSize,
|
||||
@@ -212,6 +226,7 @@ const _CompileController = {
|
||||
let {
|
||||
compileFromClsiCache,
|
||||
populateClsiCache,
|
||||
clsiCachePromptVariant,
|
||||
enablePdfCaching,
|
||||
pdfCachingMinChunkSize,
|
||||
pdfDownloadDomain,
|
||||
@@ -294,6 +309,7 @@ const _CompileController = {
|
||||
compileGroup: limits?.compileGroup,
|
||||
clsiServerId,
|
||||
clsiCacheShard,
|
||||
clsiCachePromptVariant,
|
||||
validationProblems,
|
||||
stats,
|
||||
timings,
|
||||
|
||||
@@ -386,6 +386,7 @@ const _ProjectController = {
|
||||
'external-socket-heartbeat',
|
||||
'null-test-share-modal',
|
||||
'populate-clsi-cache',
|
||||
'populate-clsi-cache-for-prompt',
|
||||
'pdf-caching-cached-url-lookup',
|
||||
'pdf-caching-mode',
|
||||
'pdf-caching-prefetch-large',
|
||||
@@ -818,14 +819,26 @@ const _ProjectController = {
|
||||
|
||||
const planDetails = Settings.plans.find(p => p.planCode === planCode)
|
||||
|
||||
const projectOwnerHasPremiumOnPageLoad =
|
||||
ownerFeatures?.compileGroup === 'priority'
|
||||
if (
|
||||
projectOwnerHasPremiumOnPageLoad &&
|
||||
splitTestAssignments['populate-clsi-cache']?.variant !== 'enabled'
|
||||
) {
|
||||
await SplitTestHandler.promises.getAssignment(
|
||||
req,
|
||||
res,
|
||||
'clsi-cache-prompt'
|
||||
)
|
||||
}
|
||||
|
||||
res.render(template, {
|
||||
title: project.name,
|
||||
priority_title: true,
|
||||
bodyClasses: ['editor'],
|
||||
project_id: project._id,
|
||||
projectName: project.name,
|
||||
projectOwnerHasPremiumOnPageLoad:
|
||||
ownerFeatures?.compileGroup === 'priority',
|
||||
projectOwnerHasPremiumOnPageLoad,
|
||||
user: {
|
||||
id: userId,
|
||||
email: user.email,
|
||||
|
||||
Reference in New Issue
Block a user