@@ -16,6 +16,7 @@ import { DIFF_VIEW_URI_SCHEME } from "../../integrations/editor/DiffViewProvider
1616
1717import { CheckpointServiceOptions , RepoPerTaskCheckpointService } from "../../services/checkpoints"
1818
19+ const WARNING_THRESHOLD_MS = 5000
1920const waitWarn = t ( "common:errors.wait_checkpoint_long_time" )
2021const failWarn = t ( "common:errors.init_checkpoint_fail_long_time" )
2122
@@ -84,8 +85,8 @@ export async function getCheckpointService(task: Task, { interval = 250 }: { int
8485 ( ) => {
8586 const elapsed = Date . now ( ) - checkpointInitStartTime
8687
87- // Show warning if we're past 5 seconds and haven't shown it yet
88- if ( ! warningShown && elapsed >= 5000 ) {
88+ // Show warning if we're past the threshold and haven't shown it yet
89+ if ( ! warningShown && elapsed >= WARNING_THRESHOLD_MS ) {
8990 warningShown = true
9091 sendCheckpointInitWarn ( task , waitWarn )
9192 }
@@ -101,6 +102,8 @@ export async function getCheckpointService(task: Task, { interval = 250 }: { int
101102 sendCheckpointInitWarn ( task , failWarn )
102103 task . enableCheckpoints = false
103104 return undefined
105+ } else {
106+ sendCheckpointInitWarn ( task , "" )
104107 }
105108 return task . checkpointService
106109 }
@@ -118,7 +121,7 @@ export async function getCheckpointService(task: Task, { interval = 250 }: { int
118121 }
119122 return service
120123 } catch ( err ) {
121- if ( err . name == "TimeoutError" && task . enableCheckpoints ) {
124+ if ( err . name === "TimeoutError" && task . enableCheckpoints ) {
122125 sendCheckpointInitWarn ( task , failWarn )
123126 }
124127 log ( `[Task#getCheckpointService] ${ err . message } ` )
0 commit comments