Don't cache web requests

This commit is contained in:
Christoph Hagen 2024-06-12 16:14:05 +02:00
parent 58b1dcb277
commit 93af0cb76d

View File

@ -23,6 +23,8 @@ final class ClassifierCreator {
let classifierUrl: URL
let urlSession = URLSession(configuration: .ephemeral)
let df = DateFormatter()
private func print(info: String) {
@ -201,7 +203,7 @@ final class ClassifierCreator {
let url = imageUrl(base: server.appendingPathComponent("images"), image: image)
let tempFile: URL, response: URLResponse
do {
(tempFile, response) = try await URLSession.shared.download(from: url)
(tempFile, response) = try await urlSession.download(from: url)
} catch {
throw TrainingError.failedToLoadImage(image, error)
}
@ -523,7 +525,7 @@ final class ClassifierCreator {
}
private func perform(_ request: URLRequest) async throws -> Data {
let (data, response) = try await URLSession.shared.data(for: request)
let (data, response) = try await urlSession.data(for: request)
let code = (response as! HTTPURLResponse).statusCode
guard code == 200 else {
throw TrainingError.invalidResponse(request.url!, code)