فهرست منبع

[web] pre-populate clsi-cache ahead of showing survey (#29221)

* [web] pre-populate clsi-cache ahead of showing survey

* [web] tweak variant checks

Co-authored-by: Mathias Jakobsen <mathias.jakobsen@overleaf.com>

---------

Co-authored-by: Mathias Jakobsen <mathias.jakobsen@overleaf.com>
GitOrigin-RevId: 749a7a1c3b21ef2e46bc86a74631e004069c5806
Jakob Ackermann 11 ماه پیش
والد
کامیت
93526bec96

+ 8 - 1
services/web/app/src/Features/Compile/ClsiCacheManager.js

@@ -172,7 +172,14 @@ async function prepareClsiCache(
     userId,
     'populate-clsi-cache'
   )
-  if (variant !== 'enabled') return
+  if (variant !== 'enabled') {
+    // Pre-populate the cache for the users in the split-test for prompts.
+    const { variant } = await SplitTestHandler.promises.getAssignmentForUser(
+      userId,
+      'populate-clsi-cache-for-prompt'
+    )
+    if (variant !== 'enabled') return
+  }
 
   const features = await UserGetter.promises.getUserFeatures(userId)
   if (features.compileGroup !== 'priority') return

+ 12 - 1
services/web/app/src/Features/Compile/CompileController.mjs

@@ -73,9 +73,20 @@ async function _getSplitTestOptions(req, res) {
       res,
       'populate-clsi-cache'
     )
-  const populateClsiCache = populateClsiCacheVariant === 'enabled'
+  let populateClsiCache = populateClsiCacheVariant === 'enabled'
   const compileFromClsiCache = populateClsiCache // use same split-test
 
+  if (!populateClsiCache) {
+    // Pre-populate the cache for the users in the split-test for prompts.
+    // Keep the compile from cache disabled for now.
+    const { variant } = await SplitTestHandler.promises.getAssignment(
+      editorReq,
+      res,
+      'populate-clsi-cache-for-prompt'
+    )
+    populateClsiCache = variant === 'enabled'
+  }
+
   const pdfDownloadDomain = Settings.pdfDownloadDomain
 
   if (!req.query.enable_pdf_caching) {