File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,26 +105,21 @@ export class CodacyCloud implements vscode.Disposable {
105105
106106 try {
107107 // Check if repository state is fully populated
108- if ( ! gitRepository . state . HEAD && gitRepository . state . remotes ?. length === 0 ) {
108+ if ( ! gitRepository . state . HEAD && gitRepository . state . remotes ?. length === 0 && ! this . _stateChangeDisposable ) {
109109 Logger . debug ( 'Repository state is not fully populated yet, waiting for state change...' )
110110 this . state = CodacyCloudState . Initializing
111111
112- // Clean up any existing state change listener
113- if ( this . _stateChangeDisposable ) {
114- this . _stateChangeDisposable . dispose ( )
115- this . _stateChangeDisposable = undefined
116- }
117-
118112 // Set up timeout to prevent memory leak
119113 const timeoutMs = 30000
120114 let hasRepositoryStateTimedOut = false
121115 const repositoryStateTimeout = setTimeout ( ( ) => {
122116 hasRepositoryStateTimedOut = true
123- Logger . appendLine ( `Repository state change timeout after ${ timeoutMs } ms, assuming repository is not valid` )
124117 if ( this . _stateChangeDisposable ) {
125118 this . _stateChangeDisposable . dispose ( )
126119 this . _stateChangeDisposable = undefined
127120 }
121+
122+ Logger . appendLine ( `Repository state change timeout after ${ timeoutMs } ms, assuming repository is not valid` )
128123 this . state = CodacyCloudState . NoGitRepository
129124 } , timeoutMs )
130125
You can’t perform that action at this time.
0 commit comments