From 58eb1457177d7b43a83649caddc95f0911ded558 Mon Sep 17 00:00:00 2001 From: Hermes Date: Wed, 12 Aug 2026 19:51:32 +0000 Subject: [PATCH] Fix compile: await LogStore calls from non-MainActor GiteaClient LogStore is @MainActor; GiteaClient.request is not main-actor-isolated, so the 5 LogStore.shared.log calls in the request handler need 'await' under Swift 5 strict concurrency. Without them the build fails at compile time. --- GiteaPR/Networking/GiteaClient.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/GiteaPR/Networking/GiteaClient.swift b/GiteaPR/Networking/GiteaClient.swift index 5509701..1fff7bc 100644 --- a/GiteaPR/Networking/GiteaClient.swift +++ b/GiteaPR/Networking/GiteaClient.swift @@ -78,23 +78,23 @@ struct GiteaClient { let (data, response) = try await session.data(for: req) guard let http = response as? HTTPURLResponse else { - LogStore.shared.log(.error, "\(method) \(path) → invalid response") + await LogStore.shared.log(.error, "\(method) \(path) → invalid response") throw APIError.invalidResponse } switch http.statusCode { case 200...299: - LogStore.shared.log(.info, "\(method) \(path) → \(http.statusCode)") + await LogStore.shared.log(.info, "\(method) \(path) → \(http.statusCode)") return data case 401, 403: - LogStore.shared.log(.error, "\(method) \(path) → \(http.statusCode) unauthorized") + await LogStore.shared.log(.error, "\(method) \(path) → \(http.statusCode) unauthorized") throw APIError.unauthorized case 404: - LogStore.shared.log(.error, "\(method) \(path) → 404 not found") + await LogStore.shared.log(.error, "\(method) \(path) → 404 not found") throw APIError.notFound default: let message = (try? Self.decoder.decode([String: String].self, from: data))?["message"] - LogStore.shared.log(.error, "\(method) \(path) → \(http.statusCode) \(message ?? "")") + await LogStore.shared.log(.error, "\(method) \(path) → \(http.statusCode) \(message ?? "")") throw APIError.httpStatus(http.statusCode, message) } }