Implement test to reduce compile timeout to 20 seconds (#14705)

Compile timeout reduction to 20s for treatment users

Co-authored-by: Rebeka <rebeka.dekany@overleaf.com>
GitOrigin-RevId: 54f70fe4b1fc631cef966deb0c1d28c904dd3a44
This commit is contained in:
Thomas
2023-09-19 08:03:52 +00:00
committed by Copybot
co-authored by Rebeka
parent d04a1d3767
commit 31cb9e336b
22 changed files with 838 additions and 8 deletions
@@ -34,6 +34,7 @@ export function DetachCompileProvider({ children }) {
fileList: _fileList,
hasChanges: _hasChanges,
highlights: _highlights,
isProjectOwner: _isProjectOwner,
lastCompileOptions: _lastCompileOptions,
logEntries: _logEntries,
logEntryAnnotations: _logEntryAnnotations,
@@ -55,6 +56,7 @@ export function DetachCompileProvider({ children }) {
setStopOnValidationError: _setStopOnValidationError,
showLogs: _showLogs,
showCompileTimeWarning: _showCompileTimeWarning,
showNewCompileTimeoutUI: _showNewCompileTimeoutUI,
showFasterCompilesFeedbackUI: _showFasterCompilesFeedbackUI,
stopOnFirstError: _stopOnFirstError,
stopOnValidationError: _stopOnValidationError,
@@ -135,6 +137,12 @@ export function DetachCompileProvider({ children }) {
'detacher',
'detached'
)
const [isProjectOwner] = useDetachStateWatcher(
'isProjectOwner',
_isProjectOwner,
'detacher',
'detached'
)
const [lastCompileOptions] = useDetachStateWatcher(
'lastCompileOptions',
_lastCompileOptions,
@@ -189,6 +197,12 @@ export function DetachCompileProvider({ children }) {
'detacher',
'detached'
)
const [showNewCompileTimeoutUI] = useDetachStateWatcher(
'showNewCompileTimeoutUI',
_showNewCompileTimeoutUI,
'detacher',
'detached'
)
const [showFasterCompilesFeedbackUI] = useDetachStateWatcher(
'showFasterCompilesFeedbackUI',
_showFasterCompilesFeedbackUI,
@@ -384,6 +398,7 @@ export function DetachCompileProvider({ children }) {
fileList,
hasChanges,
highlights,
isProjectOwner,
lastCompileOptions,
logEntryAnnotations,
logEntries,
@@ -409,6 +424,7 @@ export function DetachCompileProvider({ children }) {
setStopOnValidationError,
showLogs,
showCompileTimeWarning,
showNewCompileTimeoutUI,
showFasterCompilesFeedbackUI,
startCompile,
stopCompile,
@@ -437,6 +453,7 @@ export function DetachCompileProvider({ children }) {
fileList,
hasChanges,
highlights,
isProjectOwner,
lastCompileOptions,
logEntryAnnotations,
logEntries,
@@ -460,6 +477,7 @@ export function DetachCompileProvider({ children }) {
setStopOnValidationError,
showCompileTimeWarning,
showLogs,
showNewCompileTimeoutUI,
showFasterCompilesFeedbackUI,
startCompile,
stopCompile,
@@ -66,6 +66,7 @@ export const CompileContextPropTypes = {
setStopOnValidationError: PropTypes.func.isRequired,
showCompileTimeWarning: PropTypes.bool.isRequired,
showLogs: PropTypes.bool.isRequired,
showNewCompileTimeoutUI: PropTypes.string,
showFasterCompilesFeedbackUI: PropTypes.bool.isRequired,
stopOnFirstError: PropTypes.bool.isRequired,
stopOnValidationError: PropTypes.bool.isRequired,
@@ -84,7 +85,11 @@ export function LocalCompileProvider({ children }) {
const { hasPremiumCompile, isProjectOwner } = useEditorContext()
const { _id: projectId, rootDocId } = useProjectContext()
const {
_id: projectId,
rootDocId,
showNewCompileTimeoutUI,
} = useProjectContext()
const { pdfPreviewOpen } = useLayoutContext()
@@ -555,6 +560,7 @@ export function LocalCompileProvider({ children }) {
fileList,
hasChanges,
highlights,
isProjectOwner,
lastCompileOptions,
logEntryAnnotations,
logEntries,
@@ -580,6 +586,7 @@ export function LocalCompileProvider({ children }) {
setStopOnFirstError,
setStopOnValidationError,
showLogs,
showNewCompileTimeoutUI,
showFasterCompilesFeedbackUI,
startCompile,
stopCompile,
@@ -609,6 +616,7 @@ export function LocalCompileProvider({ children }) {
fileList,
hasChanges,
highlights,
isProjectOwner,
lastCompileOptions,
logEntries,
logEntryAnnotations,
@@ -629,6 +637,7 @@ export function LocalCompileProvider({ children }) {
setStopOnValidationError,
showCompileTimeWarning,
showLogs,
showNewCompileTimeoutUI,
showFasterCompilesFeedbackUI,
startCompile,
stopCompile,
@@ -33,6 +33,7 @@ export const projectShape = {
_id: PropTypes.string.isRequired,
email: PropTypes.string.isRequired,
}),
useNewCompileTimeoutUI: PropTypes.string,
}
ProjectContext.Provider.propTypes = {
@@ -79,8 +80,20 @@ export function ProjectProvider({ children }) {
features,
publicAccesLevel: publicAccessLevel,
owner,
showNewCompileTimeoutUI,
} = project || projectFallback
// temporary override for new compile timeout
const forceNewCompileTimeout = new URLSearchParams(
window.location.search
).get('force_new_compile_timeout')
const newCompileTimeoutOverride =
forceNewCompileTimeout === 'active'
? 'active'
: forceNewCompileTimeout === 'changing'
? 'changing'
: undefined
const value = useMemo(() => {
return {
_id,
@@ -91,6 +104,8 @@ export function ProjectProvider({ children }) {
features,
publicAccessLevel,
owner,
showNewCompileTimeoutUI:
newCompileTimeoutOverride || showNewCompileTimeoutUI,
}
}, [
_id,
@@ -101,6 +116,8 @@ export function ProjectProvider({ children }) {
features,
publicAccessLevel,
owner,
showNewCompileTimeoutUI,
newCompileTimeoutOverride,
])
return (