@@ -328,13 +328,7 @@ package final actor SemanticIndexManager {
328
328
}
329
329
330
330
private func waitForBuildGraphGenerationTasks( ) async {
331
- await withTaskGroup ( of: Void . self) { taskGroup in
332
- for generateBuildGraphTask in scheduleIndexingTasks. values {
333
- taskGroup. addTask {
334
- await generateBuildGraphTask. value
335
- }
336
- }
337
- }
331
+ await scheduleIndexingTasks. values. concurrentForEach { await $0. value }
338
332
}
339
333
340
334
/// Wait for all in-progress index tasks to finish.
@@ -344,18 +338,13 @@ package final actor SemanticIndexManager {
344
338
// can await the index tasks below.
345
339
await waitForBuildGraphGenerationTasks ( )
346
340
347
- await withTaskGroup ( of: Void . self) { taskGroup in
348
- for (_, status) in inProgressIndexTasks {
349
- switch status {
350
- case . waitingForPreparation( preparationTaskID: _, indexTask: let indexTask) ,
351
- . preparing( preparationTaskID: _, indexTask: let indexTask) ,
352
- . updatingIndexStore( updateIndexStoreTask: _, indexTask: let indexTask) :
353
- taskGroup. addTask {
354
- await indexTask. value
355
- }
356
- }
341
+ await inProgressIndexTasks. concurrentForEach { ( _, status) in
342
+ switch status {
343
+ case . waitingForPreparation( preparationTaskID: _, indexTask: let indexTask) ,
344
+ . preparing( preparationTaskID: _, indexTask: let indexTask) ,
345
+ . updatingIndexStore( updateIndexStoreTask: _, indexTask: let indexTask) :
346
+ await indexTask. value
357
347
}
358
- await taskGroup. waitForAll ( )
359
348
}
360
349
index. pollForUnitChangesAndWait ( )
361
350
logger. debug ( " Done waiting for up-to-date index " )
@@ -757,17 +746,9 @@ package final actor SemanticIndexManager {
757
746
}
758
747
indexTasksWereScheduled ( newIndexTasks)
759
748
}
760
- let indexTasksImmutable = indexTasks
761
749
762
750
return Task ( priority: priority) {
763
- await withTaskGroup ( of: Void . self) { taskGroup in
764
- for indexTask in indexTasksImmutable {
765
- taskGroup. addTask {
766
- await indexTask. value
767
- }
768
- }
769
- await taskGroup. waitForAll ( )
770
- }
751
+ await indexTasks. concurrentForEach { await $0. value }
771
752
}
772
753
}
773
754
}
0 commit comments