Skip to content

Commit

Permalink
Simplify DispatchGroup/DispatchSemaphore usage
Browse files Browse the repository at this point in the history
  • Loading branch information
plu committed Jan 13, 2022
1 parent 8d4b724 commit 97ccc8d
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions Sources/Workspace/Workspace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2275,17 +2275,14 @@ extension Workspace {

// finally download zip files, if any
for artifact in (zipArtifacts.map{ $0 }) {
semaphore.wait()
group.enter()
defer { group.leave() }

let parentDirectory = self.location.artifactsDirectory.appending(component: artifact.packageRef.identity.description)
guard observabilityScope.trap ({ try fileSystem.createDirectory(parentDirectory, recursive: true) }) else {
continue
}

let archivePath = parentDirectory.appending(component: artifact.url.lastPathComponent)

semaphore.wait()
group.enter()
var headers = HTTPClientHeaders()
headers.add(name: "Accept", value: "application/octet-stream")
Expand Down

0 comments on commit 97ccc8d

Please sign in to comment.