Merge pull request #35350 from overleaf/mj-up-timeouts

[web] Increase reconnection window in editor

GitOrigin-RevId: e6ffb4ecda170eb171455a9c692900ce71309c88
This commit is contained in:
Mathias Jakobsen
2026-09-17 11:22:37 +00:00
committed by Copybot
parent 6f8ecc7678
commit 843aae01c9
3 changed files with 18 additions and 2 deletions
@@ -12,8 +12,14 @@ import { useEditorManagerContext } from '@/features/ide-react/context/editor-man
import { useIdeReactContext } from '@/features/ide-react/context/ide-react-context'
import { PermissionsLevel } from '@/features/ide-react/types/permissions'
import useEventListener from '@/shared/hooks/use-event-listener'
import { isSplitTestEnabled } from '@/utils/splitTestUtils'
const MAX_UNSAVED_SECONDS = 30 // lock the editor after this time if unsaved
const intermittentConnectionImprovementsEnabled = isSplitTestEnabled(
'intermittent-connection-improvements'
)
// lock the editor after this time if unsaved
const MAX_UNSAVED_SECONDS = intermittentConnectionImprovementsEnabled ? 600 : 30
type UnsavedDocsContextValue = {
unsavedDocs: Map<string, number>
@@ -29,13 +29,22 @@ import {
RawEditOperation,
} from 'overleaf-editor-core/lib/types'
import { HistoryOTShareDoc } from '../../../../../types/share-doc'
import { isSplitTestEnabled } from '@/utils/splitTestUtils'
const intermittentConnectionImprovementsEnabled = isSplitTestEnabled(
'intermittent-connection-improvements'
)
// All times below are in milliseconds
const SINGLE_USER_FLUSH_DELAY = 2000
const MULTI_USER_FLUSH_DELAY = 500
const INFLIGHT_OP_TIMEOUT = 5000 // Retry sending ops after 5 seconds without an ack
const WAIT_FOR_CONNECTION_TIMEOUT = 500
const FATAL_OP_TIMEOUT = 45000
const FATAL_OP_TIMEOUT = intermittentConnectionImprovementsEnabled
? // 10 minutes
600_000
: // 45 seconds
45_000
const RECENT_ACK_LIMIT = 2 * SINGLE_USER_FLUSH_DELAY
type Update = Record<string, any>