@@ -91,23 +91,24 @@ export function writeSessionFile(sessionDetails: EditorServicesSessionDetails) {
9191
9292export function waitForSessionFile ( callback : WaitForSessionFileCallback ) {
9393
94- function innerTryFunc ( remainingTries : number ) {
94+ function innerTryFunc ( remainingTries : number , delayMilliseconds : number ) {
9595 if ( remainingTries == 0 ) {
9696 callback ( undefined , "Timed out waiting for session file to appear." ) ;
9797 }
9898 else if ( ! checkIfFileExists ( sessionFilePath ) ) {
9999 // Wait a bit and try again
100- setTimeout ( function ( ) { innerTryFunc ( remainingTries - 1 ) ; } , 500 ) ;
100+ setTimeout (
101+ function ( ) { innerTryFunc ( remainingTries - 1 , delayMilliseconds ) ; } ,
102+ delayMilliseconds ) ;
101103 }
102104 else {
103105 // Session file was found, load and return it
104106 callback ( readSessionFile ( ) , undefined ) ;
105107 }
106108 }
107109
108- // Since the delay is 500ms, 50 tries gives 25 seconds of time
109- // for the session file to appear
110- innerTryFunc ( 50 ) ;
110+ // Try once per second for 60 seconds, one full minute
111+ innerTryFunc ( 60 , 1000 ) ;
111112}
112113
113114export function readSessionFile ( ) : EditorServicesSessionDetails {
@@ -132,4 +133,9 @@ export function checkIfFileExists(filePath: string): boolean {
132133 catch ( e ) {
133134 return false ;
134135 }
135- }
136+ }
137+
138+ export function getTimestampString ( ) {
139+ var time = new Date ( ) ;
140+ return `[${ time . getHours ( ) } :${ time . getMinutes ( ) } :${ time . getSeconds ( ) } ]`
141+ }
0 commit comments