@@ -913,23 +913,43 @@ export class CodeSearchRepoTracker extends Disposable {
913
913
}
914
914
915
915
if ( currentRepoEntry . status === RepoStatus . BuildingIndex ) {
916
- this . _logService . logger . trace ( `CodeSearchRepoTracker.startPollingForRepoIndexingComplete(${ repo . rootUri } ). Checking endpoint for status.` ) ;
917
- const polledState = await this . getRepoIndexStatusFromEndpoint ( currentRepoEntry . repo , currentRepoEntry . remoteInfo , CancellationToken . None ) ;
918
- this . _logService . logger . trace ( `CodeSearchRepoTracker.startPollingForRepoIndexingComplete(${ repo . rootUri } ). Got back new status from endpoint: ${ polledState . status } .` ) ;
919
-
920
- if ( polledState . status === RepoStatus . Ready ) {
921
- this . _logService . logger . trace ( `CodeSearchRepoTracker.startPollingForRepoIndexingComplete(${ repo . rootUri } ). Repo indexed successfully.` ) ;
916
+ const attemptNumber = pollEntry . attemptNumber ++ ;
917
+ if ( attemptNumber > this . maxPollingAttempts ) {
918
+ this . _logService . logger . trace ( `CodeSearchRepoTracker.startPollingForRepoIndexingComplete(${ repo . rootUri } ). Max attempts reached. Stopping polling.` ) ;
922
919
if ( ! this . _isDisposed ) {
923
- this . updateRepoEntry ( repo , polledState ) ;
920
+ this . updateRepoEntry ( repo , { status : RepoStatus . CouldNotCheckIndexStatus , repo : currentRepoEntry . repo , remoteInfo : currentRepoEntry . remoteInfo } ) ;
924
921
}
925
922
return onComplete ( ) ;
926
923
}
927
924
928
- if ( pollEntry . attemptNumber ++ > this . maxPollingAttempts ) {
929
- this . _logService . logger . trace ( `CodeSearchRepoTracker.startPollingForRepoIndexingComplete(${ repo . rootUri } ). Max attempts reached. Stopping polling.` ) ;
930
- onComplete ( ) ;
931
- this . updateRepoEntry ( repo , polledState ) ;
932
- return ;
925
+ this . _logService . logger . trace ( `CodeSearchRepoTracker.startPollingForRepoIndexingComplete(${ repo . rootUri } ). Checking endpoint for status.` ) ;
926
+ let polledState : RepoEntry | undefined ;
927
+ try {
928
+ polledState = await this . getRepoIndexStatusFromEndpoint ( currentRepoEntry . repo , currentRepoEntry . remoteInfo , CancellationToken . None ) ;
929
+ } catch {
930
+ // noop
931
+ }
932
+ this . _logService . logger . trace ( `CodeSearchRepoTracker.startPollingForRepoIndexingComplete(${ repo . rootUri } ). Got back new status from endpoint: ${ polledState ?. status } .` ) ;
933
+
934
+ switch ( polledState ?. status ) {
935
+ case RepoStatus . Ready : {
936
+ this . _logService . logger . trace ( `CodeSearchRepoTracker.startPollingForRepoIndexingComplete(${ repo . rootUri } ). Repo indexed successfully.` ) ;
937
+ if ( ! this . _isDisposed ) {
938
+ this . updateRepoEntry ( repo , polledState ) ;
939
+ }
940
+ return onComplete ( ) ;
941
+ }
942
+ case RepoStatus . BuildingIndex : {
943
+ // Poll again
944
+ return ;
945
+ }
946
+ default : {
947
+ // We got some other state, so stop polling
948
+ if ( ! this . _isDisposed ) {
949
+ this . updateRepoEntry ( repo , polledState ?? { status : RepoStatus . CouldNotCheckIndexStatus , repo : currentRepoEntry . repo , remoteInfo : currentRepoEntry . remoteInfo } ) ;
950
+ }
951
+ return onComplete ( ) ;
952
+ }
933
953
}
934
954
} else {
935
955
this . _logService . logger . trace ( `CodeSearchRepoTracker.startPollingForRepoIndexingComplete(${ repo . rootUri } ). Found unknown repo state: ${ currentRepoEntry . status } . Stopping polling` ) ;
0 commit comments