diff --git a/Sources/Hummingbird/Application.swift b/Sources/Hummingbird/Application.swift index b6caf9198..332c69a3c 100644 --- a/Sources/Hummingbird/Application.swift +++ b/Sources/Hummingbird/Application.swift @@ -189,10 +189,8 @@ public final class HBApplication: HBExtensible { /// Version of `run` that can be called from asynchronous context @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) public func asyncRun() async throws { - try await self.onExecutionQueue { app in - try app.start() - app.wait() - } + try self.start() + await self.asyncWait() } /// Start application @@ -254,22 +252,6 @@ public final class HBApplication: HBExtensible { } } - /// Run throwing closure on private execution queue - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - private func onExecutionQueue(_ process: @Sendable @escaping (HBApplication) throws -> Void) async throws { - let unsafeApp = HBUnsafeTransfer(self) - try await withCheckedThrowingContinuation { continuation in - HBApplication.executionQueue.async { - do { - try process(unsafeApp.wrappedValue) - continuation.resume() - } catch { - continuation.resume(throwing: error) - } - } - } - } - /// Run closure on private execution queue @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) private func onExecutionQueue(_ process: @Sendable @escaping (HBApplication) -> Void) async { diff --git a/Sources/PerformanceTest/main.swift b/Sources/PerformanceTest/main.swift index 8b90fada4..6589811dd 100644 --- a/Sources/PerformanceTest/main.swift +++ b/Sources/PerformanceTest/main.swift @@ -18,7 +18,7 @@ import NIOPosix // get environment let hostname = HBEnvironment.shared.get("SERVER_HOSTNAME") ?? "127.0.0.1" -let port = HBEnvironment.shared.get("SERVER_PORT", as: Int.self) ?? 8080 +let port = HBEnvironment.shared.get("SERVER_PORT", as: Int.self) ?? 8081 // create app let elg = MultiThreadedEventLoopGroup(numberOfThreads: 2) @@ -54,6 +54,4 @@ app.router.get("json") { _ in } // run app -if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) { - try await app.asyncRun() -} +try app.run()