From 56ddd8df75582a29744d14cb8d95872c5822ec03 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Tue, 2 Aug 2022 01:17:50 +0300 Subject: [PATCH] OCI's HTTP client: prevent the usage of NIO Transport Services (#168) --- Sources/tart/OCI/Registry.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sources/tart/OCI/Registry.swift b/Sources/tart/OCI/Registry.swift index 3cc91d6..bc27dee 100644 --- a/Sources/tart/OCI/Registry.swift +++ b/Sources/tart/OCI/Registry.swift @@ -2,6 +2,7 @@ import Foundation import NIOCore import NIOHTTP1 import AsyncHTTPClient +import NIOPosix enum RegistryError: Error { case UnexpectedHTTPStatusCode(when: String, code: UInt, details: String = "") @@ -75,8 +76,10 @@ struct TokenResponse: Decodable, Authentication { } class Registry { - private let httpClient = HTTPClient(eventLoopGroupProvider: .createNew) - + private let httpClient = HTTPClient( + eventLoopGroupProvider: .shared(MultiThreadedEventLoopGroup(numberOfThreads: 1)) + ) + deinit { try! httpClient.syncShutdown() }