@@ -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 " )
@@ -774,17 +763,9 @@ package final actor SemanticIndexManager {
774
763
}
775
764
indexTasksWereScheduled ( newIndexTasks)
776
765
}
777
- let indexTasksImmutable = indexTasks
778
766
779
767
return Task ( priority: priority) {
780
- await withTaskGroup ( of: Void . self) { taskGroup in
781
- for indexTask in indexTasksImmutable {
782
- taskGroup. addTask {
783
- await indexTask. value
784
- }
785
- }
786
- await taskGroup. waitForAll ( )
787
- }
768
+ await indexTasks. concurrentForEach { await $0. value }
788
769
}
789
770
}
790
771
}
0 commit comments