Skip to content

Commit

Permalink
Avoid task group
Browse files Browse the repository at this point in the history
  • Loading branch information
finestructure committed Sep 24, 2023
1 parent b8172f7 commit 63939f6
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions Sources/App/Commands/Common.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,11 @@ func updatePackages(client: Client,
logger.critical("updatePackages: unusually high error rate: \(errors)/\(total) = \(errorRate)%")
}
}
let updates = await withThrowingTaskGroup(of: Void.self) { group in
for result in results {
group.addTask {
try await updatePackage(client: client,
database: database,
logger: logger,
result: result,
stage: stage)
}
}
return await group.results()
for result in results {
try await updatePackage(client: client, database: database, logger: logger, result: result, stage: stage)
}

logger.debug("updateStatus ops: \(updates.count)")
logger.debug("updateStatus ops: \(results.count)")
}


Expand Down

0 comments on commit 63939f6

Please sign in to comment.