@@ -142,9 +142,11 @@ export class GitProviderService implements Disposable {
142142 get onDidChangeRepositories ( ) : Event < RepositoriesChangeEvent > {
143143 return this . _onDidChangeRepositories . event ;
144144 }
145+
145146 private fireRepositoriesChanged ( added ?: Repository [ ] , removed ?: Repository [ ] ) {
146- const openSchemes = this . openRepositories . map ( r => r . uri . scheme ) ;
147147 if ( this . container . telemetry . enabled ) {
148+ const openSchemes = this . openRepositories . map ( r => r . uri . scheme ) ;
149+
148150 this . container . telemetry . setGlobalAttributes ( {
149151 'repositories.count' : openSchemes . length ,
150152 'repositories.schemes' : joinUnique ( openSchemes , ',' ) ,
@@ -163,7 +165,7 @@ export class GitProviderService implements Disposable {
163165 this . _onDidChangeRepositories . fire ( { added : added ?? [ ] , removed : removed ?? [ ] , etag : this . _etag } ) ;
164166
165167 if ( added ?. length && this . container . telemetry . enabled ) {
166- queueMicrotask ( async ( ) => {
168+ setTimeout ( async ( ) => {
167169 for ( const repo of added ) {
168170 const remoteProviders = new Set < string > ( ) ;
169171
@@ -181,7 +183,7 @@ export class GitProviderService implements Disposable {
181183 'repository.remoteProviders' : join ( remoteProviders , ',' ) ,
182184 } ) ;
183185 }
184- } ) ;
186+ } , 0 ) ;
185187 }
186188 }
187189
@@ -541,10 +543,12 @@ export class GitProviderService implements Disposable {
541543 > ( 'git.autoRepositoryDetection' ) ;
542544
543545 if ( this . container . telemetry . enabled ) {
544- queueMicrotask ( ( ) =>
545- this . container . telemetry . sendEvent ( 'providers/registrationComplete' , {
546- 'config.git.autoRepositoryDetection' : autoRepositoryDetection ,
547- } ) ,
546+ setTimeout (
547+ ( ) =>
548+ this . container . telemetry . sendEvent ( 'providers/registrationComplete' , {
549+ 'config.git.autoRepositoryDetection' : autoRepositoryDetection ,
550+ } ) ,
551+ 0 ,
548552 ) ;
549553 }
550554
@@ -576,8 +580,8 @@ export class GitProviderService implements Disposable {
576580
577581 private _discoveredWorkspaceFolders = new Map < WorkspaceFolder , Promise < Repository [ ] > > ( ) ;
578582
579- private _isDiscoveringRepositories : Promise < void > | undefined ;
580- get isDiscoveringRepositories ( ) : Promise < void > | undefined {
583+ private _isDiscoveringRepositories : Promise < number > | undefined ;
584+ get isDiscoveringRepositories ( ) : Promise < number > | undefined {
581585 return this . _isDiscoveringRepositories ;
582586 }
583587
@@ -588,7 +592,7 @@ export class GitProviderService implements Disposable {
588592 this . _isDiscoveringRepositories = undefined ;
589593 }
590594
591- const deferred = defer < void > ( ) ;
595+ const deferred = defer < number > ( ) ;
592596 this . _isDiscoveringRepositories = deferred . promise ;
593597
594598 try {
@@ -630,7 +634,7 @@ export class GitProviderService implements Disposable {
630634 queueMicrotask ( ( ) => this . fireRepositoriesChanged ( added ) ) ;
631635 }
632636 } finally {
633- deferred . fulfill ( ) ;
637+ queueMicrotask ( ( ) => deferred . fulfill ( this . _etag ) ) ;
634638 }
635639 }
636640
@@ -910,7 +914,7 @@ export class GitProviderService implements Disposable {
910914 if ( visibility == null ) {
911915 visibility = await this . visibilityCore ( repoPath ) ;
912916 if ( this . container . telemetry . enabled ) {
913- queueMicrotask ( ( ) => {
917+ setTimeout ( ( ) => {
914918 const repo = this . getRepository ( repoPath ) ;
915919 this . container . telemetry . sendEvent ( 'repository/visibility' , {
916920 'repository.visibility' : visibility ,
@@ -920,7 +924,7 @@ export class GitProviderService implements Disposable {
920924 'repository.folder.scheme' : repo ?. folder ?. uri . scheme ,
921925 'repository.provider.id' : repo ?. provider . id ,
922926 } ) ;
923- } ) ;
927+ } , 0 ) ;
924928 }
925929 }
926930 return visibility ;
0 commit comments