@@ -339,13 +339,7 @@ package final actor SemanticIndexManager {
339
339
}
340
340
341
341
private func waitForBuildGraphGenerationTasks( ) async {
342
- await withTaskGroup ( of: Void . self) { taskGroup in
343
- for generateBuildGraphTask in scheduleIndexingTasks. values {
344
- taskGroup. addTask {
345
- await generateBuildGraphTask. value
346
- }
347
- }
348
- }
342
+ await scheduleIndexingTasks. values. concurrentForEach { await $0. value }
349
343
}
350
344
351
345
/// Wait for all in-progress index tasks to finish.
@@ -355,18 +349,13 @@ package final actor SemanticIndexManager {
355
349
// can await the index tasks below.
356
350
await waitForBuildGraphGenerationTasks ( )
357
351
358
- await withTaskGroup ( of: Void . self) { taskGroup in
359
- for (_, status) in inProgressIndexTasks {
360
- switch status {
361
- case . waitingForPreparation( preparationTaskID: _, indexTask: let indexTask) ,
362
- . preparing( preparationTaskID: _, indexTask: let indexTask) ,
363
- . updatingIndexStore( updateIndexStoreTask: _, indexTask: let indexTask) :
364
- taskGroup. addTask {
365
- await indexTask. value
366
- }
367
- }
352
+ await inProgressIndexTasks. concurrentForEach { ( _, status) in
353
+ switch status {
354
+ case . waitingForPreparation( preparationTaskID: _, indexTask: let indexTask) ,
355
+ . preparing( preparationTaskID: _, indexTask: let indexTask) ,
356
+ . updatingIndexStore( updateIndexStoreTask: _, indexTask: let indexTask) :
357
+ await indexTask. value
368
358
}
369
- await taskGroup. waitForAll ( )
370
359
}
371
360
index. pollForUnitChangesAndWait ( )
372
361
logger. debug ( " Done waiting for up-to-date index " )
@@ -786,17 +775,9 @@ package final actor SemanticIndexManager {
786
775
}
787
776
indexTasksWereScheduled ( newIndexTasks)
788
777
}
789
- let indexTasksImmutable = indexTasks
790
778
791
779
return Task ( priority: priority) {
792
- await withTaskGroup ( of: Void . self) { taskGroup in
793
- for indexTask in indexTasksImmutable {
794
- taskGroup. addTask {
795
- await indexTask. value
796
- }
797
- }
798
- await taskGroup. waitForAll ( )
799
- }
780
+ await indexTasks. concurrentForEach { await $0. value }
800
781
}
801
782
}
802
783
}
0 commit comments