From f7a9aa337a6d3f39d639aa08a1aeda6514e6772b Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Fri, 13 Dec 2024 11:39:06 +0100 Subject: [PATCH] Cleanup --- Sources/App/Commands/Ingest.swift | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Sources/App/Commands/Ingest.swift b/Sources/App/Commands/Ingest.swift index e5da940b3..d8df0df2f 100644 --- a/Sources/App/Commands/Ingest.swift +++ b/Sources/App/Commands/Ingest.swift @@ -245,19 +245,20 @@ func fetchMetadata(client: Client, package: Joined) async t Ingestion.Error.invalidURL(packageId: package.model.id!, url: package.model.url) } + // sas 2024-12-13: This should be an `async let` as well but it doesn't compile right now with the + // typed throw. Reported as + // https://github.com/swiftlang/swift/issues/76169 + // async let metadata = try await Current.fetchMetadata(client, owner, repository) + let metadata = try await run { + try await Current.fetchMetadata(client, owner, repository) + } rethrowing: { + Ingestion.Error(packageId: package.model.id!, + underlyingError: .fetchMetadataFailed(owner: owner, name: repository, details: "\($0)")) + } async let license = await Current.fetchLicense(client, owner, repository) async let readme = await Current.fetchReadme(client, owner, repository) - // First one should be an `async let` as well but it doesn't compile right now. Reported as - // https://github.com/swiftlang/swift/issues/76169 - return (try await Result { try await Current.fetchMetadata(client, owner, repository) } - .mapError { - Ingestion.Error(packageId: package.model.id!, - underlyingError: .fetchMetadataFailed(owner: owner, name: repository, details: "\($0)")) - } - .get(), - await license, - await readme) + return (metadata, await license, await readme) }