|
|
@@ -1,7 +1,11 @@ |
|
|
import Vapor |
|
|
|
|
|
|
|
|
@preconcurrency import Vapor |
|
|
import Dispatch |
|
|
import Dispatch |
|
|
import Logging |
|
|
import Logging |
|
|
|
|
|
|
|
|
|
|
|
private struct UncheckedApplication: @unchecked Sendable { |
|
|
|
|
|
let app: Application |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/// This extension is temporary and can be removed once Vapor gets this support. |
|
|
/// This extension is temporary and can be removed once Vapor gets this support. |
|
|
private extension Vapor.Application { |
|
|
private extension Vapor.Application { |
|
|
static let baseExecutionQueue = DispatchQueue(label: "vapor.codes.entrypoint") |
|
|
static let baseExecutionQueue = DispatchQueue(label: "vapor.codes.entrypoint") |
|
|
@@ -33,21 +37,5 @@ enum Entrypoint { |
|
|
try await app.runFromAsyncMainEntrypoint() |
|
|
try await app.runFromAsyncMainEntrypoint() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
extension Application { |
|
|
|
|
|
static let entrypointQueue = DispatchQueue(label: "app.entrypoint") |
|
|
|
|
|
|
|
|
|
|
|
func runAsync() async throws { |
|
|
|
|
|
nonisolated(unsafe) let app = self |
|
|
|
|
|
try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<Void, Error>) in |
|
|
|
|
|
Application.entrypointQueue.async { |
|
|
|
|
|
do { |
|
|
|
|
|
try app.run() |
|
|
|
|
|
continuation.resume() |
|
|
|
|
|
} catch { |
|
|
|
|
|
continuation.resume(throwing: error) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|