Skip to content

Commit

Permalink
Remove task group
Browse files Browse the repository at this point in the history
  • Loading branch information
finestructure committed Oct 4, 2023
1 parent b0c5c59 commit 496fcf9
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions Sources/App/Commands/Analyze.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,11 @@ extension Analyze {
try await createCheckoutsDirectory(client: client, logger: logger, path: checkoutDir)
}

let packageResults = await withThrowingTaskGroup(
of: (Joined<Package, Repository>).self,
returning: [Result<(Joined<Package, Repository>), Error>].self
) { group in
for pkg in packages {
group.addTask {
try await analyze(client: client, database: database, logger: logger, package: pkg)
return pkg
}
let packageResults = await packages.mapAsync { pkg in
await Result {
try await analyze(client: client, database: database, logger: logger, package: pkg)
return pkg
}

return await group.results()
}

try await updatePackages(client: client,
Expand Down

0 comments on commit 496fcf9

Please sign in to comment.