@@ -91,23 +91,24 @@ export function writeSessionFile(sessionDetails: EditorServicesSessionDetails) {
91
91
92
92
export function waitForSessionFile ( callback : WaitForSessionFileCallback ) {
93
93
94
- function innerTryFunc ( remainingTries : number ) {
94
+ function innerTryFunc ( remainingTries : number , delayMilliseconds : number ) {
95
95
if ( remainingTries == 0 ) {
96
96
callback ( undefined , "Timed out waiting for session file to appear." ) ;
97
97
}
98
98
else if ( ! checkIfFileExists ( sessionFilePath ) ) {
99
99
// Wait a bit and try again
100
- setTimeout ( function ( ) { innerTryFunc ( remainingTries - 1 ) ; } , 500 ) ;
100
+ setTimeout (
101
+ function ( ) { innerTryFunc ( remainingTries - 1 , delayMilliseconds ) ; } ,
102
+ delayMilliseconds ) ;
101
103
}
102
104
else {
103
105
// Session file was found, load and return it
104
106
callback ( readSessionFile ( ) , undefined ) ;
105
107
}
106
108
}
107
109
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 ) ;
111
112
}
112
113
113
114
export function readSessionFile ( ) : EditorServicesSessionDetails {
@@ -132,4 +133,9 @@ export function checkIfFileExists(filePath: string): boolean {
132
133
catch ( e ) {
133
134
return false ;
134
135
}
135
- }
136
+ }
137
+
138
+ export function getTimestampString ( ) {
139
+ var time = new Date ( ) ;
140
+ return `[${ time . getHours ( ) } :${ time . getMinutes ( ) } :${ time . getSeconds ( ) } ]`
141
+ }
0 commit comments