Kaynağa Gözat

Gradual rollout of new compile timeout to existing users (#15478)

* Rollout compile timeout to existing users

* Update copy for compile timeout messages

GitOrigin-RevId: bada02efb3fc506ae6e35bdb7871a58ef4295cbe
Thomas 2 yıl önce
ebeveyn
işleme
3cd0cefd30

+ 15 - 1
services/web/app/src/Features/Compile/CompileManager.js

@@ -220,9 +220,23 @@ module.exports = CompileManager = {
                       if (assignment?.variant === '20s') {
                         if (owner.signUpDate > timeoutEnforcedCutoff) {
                           limits.timeout = 20
+                          callback(null, limits)
+                        } else {
+                          SplitTestHandler.getAssignmentForMongoUser(
+                            owner,
+                            'compile-timeout-20s-existing-users',
+                            (err, assignmentExistingUsers) => {
+                              if (err) return callback(err)
+                              if (assignmentExistingUsers?.variant === '20s') {
+                                limits.timeout = 20
+                              }
+                              callback(null, limits)
+                            }
+                          )
                         }
+                      } else {
+                        callback(null, limits)
                       }
-                      callback(null, limits)
                     }
                   )
                 } else {

+ 12 - 2
services/web/app/src/Features/Editor/EditorHttpController.js

@@ -109,8 +109,18 @@ async function joinProject(req, res, next) {
           // New users will see a 10s warning and compile fail at 20s
           project.showNewCompileTimeoutUI = 'active'
         } else {
-          // Older users aren't limited to 20s, but will see a notice of upcoming changes if compile >20s
-          project.showNewCompileTimeoutUI = 'changing'
+          const existingUserTimeoutAssignment =
+            await SplitTestHandler.promises.getAssignmentForUser(
+              project.owner._id,
+              'compile-timeout-20s-existing-users'
+            )
+          if (existingUserTimeoutAssignment?.variant === '20s') {
+            // Older users in treatment see 10s warning and compile fail at 20s
+            project.showNewCompileTimeoutUI = 'active'
+          } else {
+            // Older users in control aren't limited to 20s, but will see a notice of upcoming changes if compile >20s
+            project.showNewCompileTimeoutUI = 'changing'
+          }
         }
       }
     }

+ 8 - 5
services/web/frontend/extracted-translations.json

@@ -102,7 +102,6 @@
   "browser": "",
   "bulk_accept_confirm": "",
   "bulk_reject_confirm": "",
-  "but_note_that_free_compile_timeout_limit_will_be_reduced_on_x_date": "",
   "by_subscribing_you_agree_to_our_terms_of_service": "",
   "can_edit": "",
   "can_link_institution_email_acct_to_institution_acct": "",
@@ -168,7 +167,7 @@
   "comment": "",
   "commit": "",
   "common": "",
-  "common_causes_of_compile_timeouts_are": "",
+  "common_causes_of_compile_timeouts_include": "",
   "commons_plan_tooltip": "",
   "compact": "",
   "company_name": "",
@@ -179,8 +178,8 @@
   "compile_larger_projects": "",
   "compile_mode": "",
   "compile_terminated_by_user": "",
-  "compile_timeout_will_be_reduced_project_exceeds_limit_speed_up_compile": "",
   "compiler": "",
+  "compiles_on_our_free_plan_are_now_on_faster_servers": "",
   "compiling": "",
   "configure_sso": "",
   "confirm": "",
@@ -779,7 +778,6 @@
   "organize_projects": "",
   "other_logs_and_files": "",
   "other_output_files": "",
-  "other_ways_to_prevent_compile_timeouts": "",
   "output_file": "",
   "overall_theme": "",
   "overleaf": "",
@@ -895,6 +893,7 @@
   "ready_to_join_x": "",
   "ready_to_join_x_in_group_y": "",
   "realtime_track_changes": "",
+  "reasons_for_compile_timeouts": "",
   "reauthorize_github_account": "",
   "recaptcha_conditions": "",
   "recent_commits_in_github": "",
@@ -1341,6 +1340,10 @@
   "we_sent_new_code": "",
   "wed_love_you_to_stay": "",
   "welcome_to_sl": "",
+  "were_in_the_process_of_reducing_compile_timeout_which_may_affect_this_project": "",
+  "were_in_the_process_of_reducing_compile_timeout_which_may_affect_your_project": "",
+  "weve_recently_reduced_the_compile_timeout_limit_which_may_have_affected_this_project": "",
+  "weve_recently_reduced_the_compile_timeout_limit_which_may_have_affected_your_project": "",
   "what_does_this_mean": "",
   "what_does_this_mean_for_you": "",
   "what_happens_when_sso_is_enabled": "",
@@ -1376,7 +1379,7 @@
   "you_have_been_invited_to_transfer_management_of_your_account": "",
   "you_have_been_invited_to_transfer_management_of_your_account_to": "",
   "you_have_been_removed_from_this_project_and_will_be_redirected_to_project_dashboard": "",
-  "you_may_be_able_to_prevent_a_compile_timeout": "",
+  "you_may_be_able_to_fix_issues_to_speed_up_the_compile": "",
   "you_need_to_configure_your_sso_settings": "",
   "you_will_be_able_to_reassign_subscription": "",
   "youll_get_best_results_in_visual_but_can_be_used_in_source": "",

+ 21 - 14
services/web/frontend/js/features/pdf-preview/components/compile-timeout-changing-soon.tsx

@@ -17,7 +17,7 @@ export const CompileTimeoutChangingSoon: FC<{
 }> = ({ isProjectOwner = false, handleDismissChangingSoon }) => {
   const { t } = useTranslation()
 
-  const compileTimeoutBlogLinks = [
+  const compileTimeoutChangesBlogLink = (
     /* eslint-disable-next-line jsx-a11y/anchor-has-content */
     <a
       aria-label={t('read_more_about_free_compile_timeouts_servers')}
@@ -26,7 +26,10 @@ export const CompileTimeoutChangingSoon: FC<{
       rel="noopener noreferrer"
       target="_blank"
       onClick={sendInfoClickEvent}
-    />,
+    />
+  )
+
+  const fixingCompileTimeoutsLearnLink = (
     /* eslint-disable-next-line jsx-a11y/anchor-has-content */
     <a
       aria-label={t('read_more_about_fix_prevent_timeout')}
@@ -34,8 +37,8 @@ export const CompileTimeoutChangingSoon: FC<{
       key="compileTimeoutBlogLink2"
       target="_blank"
       rel="noopener noreferrer"
-    />,
-  ]
+    />
+  )
 
   if (isProjectOwner) {
     return (
@@ -56,11 +59,14 @@ export const CompileTimeoutChangingSoon: FC<{
           <div>
             <p>
               <Trans
-                i18nKey="compile_timeout_will_be_reduced_project_exceeds_limit_speed_up_compile"
-                components={compileTimeoutBlogLinks}
-                values={{ date: 'October 27 2023' }}
-                shouldUnescape
-                tOptions={{ interpolation: { escapeValue: true } }}
+                i18nKey="compiles_on_our_free_plan_are_now_on_faster_servers"
+                components={[compileTimeoutChangesBlogLink]}
+              />
+            </p>
+            <p className="row-spaced">
+              <Trans
+                i18nKey="you_may_be_able_to_fix_issues_to_speed_up_the_compile"
+                components={[fixingCompileTimeoutsLearnLink]}
               />{' '}
               <Trans
                 i18nKey="and_you_can_upgrade_for_plenty_more_compile_time"
@@ -85,11 +91,12 @@ export const CompileTimeoutChangingSoon: FC<{
         <div>
           <p>
             <Trans
-              i18nKey="compile_timeout_will_be_reduced_project_exceeds_limit_speed_up_compile"
-              components={compileTimeoutBlogLinks}
-              values={{ date: 'October 27 2023' }}
-              shouldUnescape
-              tOptions={{ interpolation: { escapeValue: true } }}
+              i18nKey="compiles_on_our_free_plan_are_now_on_faster_servers"
+              components={[compileTimeoutChangesBlogLink]}
+            />{' '}
+            <Trans
+              i18nKey="you_may_be_able_to_fix_issues_to_speed_up_the_compile"
+              components={[fixingCompileTimeoutsLearnLink]}
             />
           </p>
           <p className="row-spaced">

+ 48 - 27
services/web/frontend/js/features/pdf-preview/components/timeout-upgrade-prompt-new.tsx

@@ -42,6 +42,7 @@ function TimeoutUpgradePromptNew() {
         compileTimeChanging={compileTimeChanging}
         handleEnableStopOnFirstErrorClick={handleEnableStopOnFirstErrorClick}
         lastCompileOptions={lastCompileOptions}
+        isProjectOwner={isProjectOwner}
       />
     </>
   )
@@ -123,12 +124,14 @@ type PreventTimeoutHelpMessageProps = {
   compileTimeChanging?: boolean
   lastCompileOptions: any
   handleEnableStopOnFirstErrorClick: () => void
+  isProjectOwner: boolean
 }
 
 const PreventTimeoutHelpMessage = memo(function PreventTimeoutHelpMessage({
   compileTimeChanging,
   lastCompileOptions,
   handleEnableStopOnFirstErrorClick,
+  isProjectOwner,
 }: PreventTimeoutHelpMessageProps) {
   const { t } = useTranslation()
 
@@ -139,38 +142,56 @@ const PreventTimeoutHelpMessage = memo(function PreventTimeoutHelpMessage({
     })
   }
 
+  const compileTimeoutChangesBlogLink = (
+    /* eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key */
+    <a
+      aria-label={t('read_more_about_free_compile_timeouts_servers')}
+      href="/blog/changes-to-free-compile-timeouts-and-servers"
+      rel="noopener noreferrer"
+      target="_blank"
+      onClick={sendInfoClickEvent}
+    />
+  )
+
   return (
     <PdfLogEntry
-      headerTitle={t('other_ways_to_prevent_compile_timeouts')}
+      headerTitle={t('reasons_for_compile_timeouts')}
       formattedContent={
         <>
           <p>
-            {t('you_may_be_able_to_prevent_a_compile_timeout')}
-            {compileTimeChanging && (
-              <>
-                {' '}
-                <Trans
-                  i18nKey="but_note_that_free_compile_timeout_limit_will_be_reduced_on_x_date"
-                  components={[
-                    // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
-                    <a
-                      aria-label={t(
-                        'read_more_about_free_compile_timeouts_servers'
-                      )}
-                      href="/blog/changes-to-free-compile-timeouts-and-servers"
-                      rel="noopener noreferrer"
-                      target="_blank"
-                      onClick={sendInfoClickEvent}
-                    />,
-                  ]}
-                  values={{ date: 'October 27 2023' }}
-                  shouldUnescape
-                  tOptions={{ interpolation: { escapeValue: true } }}
-                />
-              </>
-            )}
+            <em>
+              {compileTimeChanging ? (
+                <>
+                  {isProjectOwner ? (
+                    <Trans
+                      i18nKey="were_in_the_process_of_reducing_compile_timeout_which_may_affect_your_project"
+                      components={[compileTimeoutChangesBlogLink]}
+                    />
+                  ) : (
+                    <Trans
+                      i18nKey="were_in_the_process_of_reducing_compile_timeout_which_may_affect_this_project"
+                      components={[compileTimeoutChangesBlogLink]}
+                    />
+                  )}
+                </>
+              ) : (
+                <>
+                  {isProjectOwner ? (
+                    <Trans
+                      i18nKey="weve_recently_reduced_the_compile_timeout_limit_which_may_have_affected_your_project"
+                      components={[compileTimeoutChangesBlogLink]}
+                    />
+                  ) : (
+                    <Trans
+                      i18nKey="weve_recently_reduced_the_compile_timeout_limit_which_may_have_affected_this_project"
+                      components={[compileTimeoutChangesBlogLink]}
+                    />
+                  )}
+                </>
+              )}
+            </em>
           </p>
-          <p>{t('common_causes_of_compile_timeouts_are')}:</p>
+          <p>{t('common_causes_of_compile_timeouts_include')}:</p>
           <ul>
             <li>
               <Trans
@@ -233,7 +254,7 @@ const PreventTimeoutHelpMessage = memo(function PreventTimeoutHelpMessage({
         </>
       }
       // @ts-ignore
-      entryAriaLabel={t('other_ways_to_prevent_compile_timeouts')}
+      entryAriaLabel={t('reasons_for_compile_timeouts')}
       level="raw"
     />
   )

+ 8 - 5
services/web/locales/en.json

@@ -177,7 +177,6 @@
   "built_in": "Built-In",
   "bulk_accept_confirm": "Are you sure you want to accept the selected __nChanges__ changes?",
   "bulk_reject_confirm": "Are you sure you want to reject the selected __nChanges__ changes?",
-  "but_note_that_free_compile_timeout_limit_will_be_reduced_on_x_date": "But note that the free compile timeout limit <0>will be reduced on __date__</0>.",
   "buy_now_no_exclamation_mark": "Buy now",
   "by": "by",
   "by_registering_you_agree_to_our_terms_of_service": "By registering, you agree to our <0>terms of service</0>.",
@@ -269,7 +268,7 @@
   "comment": "Comment",
   "commit": "Commit",
   "common": "Common",
-  "common_causes_of_compile_timeouts_are": "Common causes of compile timeouts are",
+  "common_causes_of_compile_timeouts_include": "Common causes of compile timeouts include",
   "commons_plan_tooltip": "You’re on the __plan__ plan because of your affiliation with __institution__. Click to find out how to make the most of your Overleaf premium features.",
   "compact": "Compact",
   "company_name": "Company Name",
@@ -287,8 +286,8 @@
   "compile_timeout_short": "Compile timeout",
   "compile_timeout_short_info": "This is how much time you get to compile your project on the Overleaf servers. For short and simple projects, 1 minute should be enough, but you may need longer for complex or longer projects",
   "compile_timeout_short_info_basic": "This is how much time you get to compile your project on the Overleaf servers. You may need additional time for longer or more complex projects.",
-  "compile_timeout_will_be_reduced_project_exceeds_limit_speed_up_compile": "The compile timeout limit on our free plan <0>will be reduced on __date__</0> and this project currently exceeds the new limit. You may be able to fix issues to <1>speed up the compile</1>.",
   "compiler": "Compiler",
+  "compiles_on_our_free_plan_are_now_on_faster_servers": "Compiles on our free plan are now on faster servers, and we’re gradually <0>introducing a shorter compile timeout limit</0>. This project currently exceeds the new limit, so it might not compile in future.",
   "compiling": "Compiling",
   "complete": "Complete",
   "compliance": "Compliance",
@@ -1218,7 +1217,6 @@
   "other_logs_and_files": "Other logs and files",
   "other_output_files": "Download other output files",
   "other_sessions": "Other Sessions",
-  "other_ways_to_prevent_compile_timeouts": "Other ways to prevent compile timeouts",
   "our_values": "Our values",
   "output_file": "Output file",
   "over": "over",
@@ -1390,6 +1388,7 @@
   "realtime_track_changes": "Real-time track changes",
   "realtime_track_changes_info": "Now you don’t have to choose between tracked changes and typesetting in LaTeX. Leave comments, keep track of TODOs, and accept or reject others’ changes.",
   "realtime_track_changes_info_v2": "Switch on track changes to see who made every change, accept or reject others’ changes, and write comments.",
+  "reasons_for_compile_timeouts": "Reasons for compile timeouts",
   "reauthorize_github_account": "Reauthorize your GitHub Account",
   "recaptcha_conditions": "The site is protected by reCAPTCHA and the Google <1>Privacy Policy</1> and <2>Terms of Service</2> apply.",
   "recent": "Recent",
@@ -2003,6 +2002,10 @@
   "website_status": "Website status",
   "wed_love_you_to_stay": "We’d love you to stay",
   "welcome_to_sl": "Welcome to __appName__!",
+  "were_in_the_process_of_reducing_compile_timeout_which_may_affect_this_project": "We’re in the process of <0>reducing the compile timeout limit</0> on our free plan, which may affect this project in future.",
+  "were_in_the_process_of_reducing_compile_timeout_which_may_affect_your_project": "We’re in the process of <0>reducing the compile timeout limit</0> on our free plan, which may affect your project in future.",
+  "weve_recently_reduced_the_compile_timeout_limit_which_may_have_affected_this_project": "We’ve recently <0>reduced the compile timeout limit</0> on our free plan, which may have affected this project.",
+  "weve_recently_reduced_the_compile_timeout_limit_which_may_have_affected_your_project": "We’ve recently <0>reduced the compile timeout limit</0> on our free plan, which may have affected your project.",
   "what_does_this_mean": "What does this mean?",
   "what_does_this_mean_for_you": "This means:",
   "what_happens_when_sso_is_enabled": "What happens when SSO is enabled?",
@@ -2058,7 +2061,7 @@
   "you_have_been_removed_from_this_project_and_will_be_redirected_to_project_dashboard": "You have been removed from this project, and will no longer have access to it. You will be redirected to your project dashboard momentarily.",
   "you_introed_high_number": " You’ve introduced <0>__numberOfPeople__</0> people to __appName__. Good job!",
   "you_introed_small_number": " You’ve introduced <0>__numberOfPeople__</0> person to __appName__. Good job, but can you get some more?",
-  "you_may_be_able_to_prevent_a_compile_timeout": "You may be able to prevent a compile timeout using the following tips.",
+  "you_may_be_able_to_fix_issues_to_speed_up_the_compile": "You may be able to fix issues to <0>speed up the compile</0>.",
   "you_need_to_configure_your_sso_settings": "You need to configure your SSO settings before enabling SSO",
   "you_not_introed_anyone_to_sl": "You’ve not introduced anyone to __appName__ yet. Get sharing!",
   "you_plus_1": "You + 1",

+ 25 - 0
services/web/test/unit/src/Compile/CompileManagerTests.js

@@ -298,6 +298,31 @@ describe('CompileManager', function () {
             .calledWith(null, sinon.match({ timeout: 60 }))
             .should.equal(true)
         })
+        describe('user is in the compile-timeout-20s-existing-users treatment', function () {
+          beforeEach(function () {
+            this.getAssignmentForMongoUser.callsFake((user, test, cb) => {
+              if (test === 'compile-backend-class-n2d') {
+                cb(null, { variant: 'n2d' })
+              }
+              if (test === 'compile-timeout-20s') {
+                cb(null, { variant: '20s' })
+              }
+              if (test === 'compile-timeout-20s-existing-users') {
+                cb(null, { variant: '20s' })
+              }
+            })
+          })
+
+          it('should reduce compile timeout to 20s', function () {
+            this.CompileManager.getProjectCompileLimits(
+              this.project_id,
+              this.callback
+            )
+            this.callback
+              .calledWith(null, sinon.match({ timeout: 20 }))
+              .should.equal(true)
+          })
+        })
       })
       describe('user registered after the cut off date', function () {
         beforeEach(function () {