@@ -49,22 +49,22 @@ export class FileWatcher {
4949 private readonly _getStatusThread : HttpGetStatusThread ;
5050
5151 private readonly _internalWatchService : IWatchService ;
52- private readonly _externalWatchService : IWatchService ;
52+ private readonly _externalWatchService : IWatchService | undefined ;
5353
5454 private readonly _webSocketManager : WebSocketManagerThread ;
5555
5656 private readonly _clientUuid : string ;
5757
58- private readonly _installerPath : string ; // May be null
58+ private readonly _installerPath : string ;
5959
6060 private readonly _authTokenWrapper : AuthTokenWrapper ;
6161
6262 private _disposed : boolean = false ;
6363
6464 private _individualFileWatchService : IndividualFileWatchService ;
6565
66- constructor ( urlParam : string , internalWatchService : IWatchService , externalWatchService : IWatchService ,
67- installerPath : string , clientUuid : string , authTokenProvider : IAuthTokenProvider ) {
66+ constructor ( urlParam : string , internalWatchService : IWatchService , externalWatchService : IWatchService | undefined ,
67+ installerPath : string , clientUuid : string , authTokenProvider : IAuthTokenProvider | undefined ) {
6868
6969 this . _clientUuid = clientUuid ;
7070 this . _installerPath = installerPath ;
@@ -100,7 +100,7 @@ export class FileWatcher {
100100 this . _webSocketManager = new WebSocketManagerThread ( this . _wsBaseUrl , this ) ;
101101 this . _webSocketManager . queueEstablishConnection ( ) ;
102102
103- const debugTimer = new DebugTimer ( this ) ;
103+ new DebugTimer ( this ) . schedule ( ) ;
104104 }
105105
106106 public updateFileWatchStateFromGetRequest ( projectsToWatch : ProjectToWatch [ ] ) {
@@ -124,7 +124,7 @@ export class FileWatcher {
124124
125125 // For each of the projects in the local state map, if they aren't found
126126 // in the HTTP GET result, then they have been removed.
127- for ( const [ _ , value ] of this . _projectsMap ) {
127+ for ( const [ , value ] of this . _projectsMap ) {
128128 if ( ! projectIdInHttpResult . has ( value . projectToWatch . projectId ) ) {
129129 removedProjects . push ( value . projectToWatch ) ;
130130 }
@@ -147,7 +147,7 @@ export class FileWatcher {
147147
148148 let projectsToWatch = new Array < ProjectToWatch > ( ) ;
149149
150- for ( const [ key , value ] of this . _projectsMap ) {
150+ for ( const [ , value ] of this . _projectsMap ) {
151151 if ( value ) {
152152 projectsToWatch . push ( value . projectToWatch ) ;
153153 }
@@ -164,7 +164,7 @@ export class FileWatcher {
164164 // This will be the absolute path on the local drive
165165 const fullLocalPath : string = watchEntry . absolutePathWithUnixSeparators ;
166166
167- let match : ProjectToWatch = null ;
167+ let match : ProjectToWatch | undefined ;
168168
169169 for ( const ptw of projectsToWatch ) {
170170
@@ -540,7 +540,7 @@ export class FileWatcher {
540540 const pctOldProjectToWatch = oldProjectToWatch . projectCreationTimeInAbsoluteMsecs ;
541541 const pctNewProjectToWatch = ptw . projectCreationTimeInAbsoluteMsecs ;
542542
543- let newPct = null ;
543+ let newPct : number | undefined ;
544544
545545 // If both the old and new values are not null, but the value has changed, then
546546 // use the new value.
@@ -591,14 +591,14 @@ export class FileWatcher {
591591 // new.
592592 if ( ! pctOldProjectToWatch && pctNewProjectToWatch ) {
593593 newPct = pctNewProjectToWatch ;
594- const newTimeInDate = newPct != null ? new Date ( newPct ) . toString ( ) : "" ;
594+ const newTimeInDate = newPct ? new Date ( newPct ) . toString ( ) : "" ;
595595 log . info ( "The project creation time has changed. Old: " + pctOldProjectToWatch + " New: "
596596 + pctNewProjectToWatch + "(" + newTimeInDate + "), for project " + ptw . projectId ) ;
597597
598598 pctUpdated = true ;
599599 }
600600
601- if ( pctUpdated ) {
601+ if ( pctUpdated && newPct ) {
602602 // Update the object itself, in case the if-branch below this one is executed.
603603
604604 if ( ptw instanceof ProjectToWatchFromWebSocket ) {
@@ -680,7 +680,6 @@ export class FileWatcher {
680680
681681 }
682682
683- /** May return null if the installer path is not defined. */
684683 public get installerPath ( ) : string {
685684 return this . _installerPath ;
686685 }
0 commit comments