Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

2 недель назад
3 лет назад
​
​
2 недель назад
​
​
​
3 лет назад
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 недель назад
​
​
​
​
​
3 лет назад
​
2 недель назад
12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. @preconcurrency import Vapor
  2. import Dispatch
  3. import Logging
  4. private struct UncheckedApplication: @unchecked Sendable {
  5. let app: Application
  6. }
  7. /// This extension is temporary and can be removed once Vapor gets this support.
  8. private extension Vapor.Application {
  9. static let baseExecutionQueue = DispatchQueue(label: "vapor.codes.entrypoint")
  10. func runFromAsyncMainEntrypoint() async throws {
  11. try await withCheckedThrowingContinuation { continuation in
  12. Vapor.Application.baseExecutionQueue.async { [self] in
  13. do {
  14. try self.run()
  15. continuation.resume()
  16. } catch {
  17. continuation.resume(throwing: error)
  18. }
  19. }
  20. }
  21. }
  22. }
  23. @main
  24. enum Entrypoint {
  25. static func main() async throws {
  26. var env = try Environment.detect()
  27. try LoggingSystem.bootstrap(from: &env)
  28. let app = Application(env)
  29. defer { app.shutdown() }
  30. try await configure(app)
  31. do {
  32. try await app.runFromAsyncMainEntrypoint()
  33. } catch {
  34. print("STARTUP ERROR:", String(reflecting: error))
  35. throw error
  36. }
  37. }
  38. }