-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove old style
- Loading branch information
Showing
4 changed files
with
46 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import Vapor | ||
import Dispatch | ||
import Logging | ||
import MongoQueue | ||
|
||
/// This extension is temporary and can be removed once Vapor gets this support. | ||
private extension Vapor.Application { | ||
static let baseExecutionQueue = DispatchQueue(label: "vapor.codes.entrypoint") | ||
|
||
func runFromAsyncMainEntrypoint() async throws { | ||
try await withCheckedThrowingContinuation { continuation in | ||
Vapor.Application.baseExecutionQueue.async { [self] in | ||
do { | ||
try self.run() | ||
continuation.resume() | ||
} catch { | ||
continuation.resume(throwing: error) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@main | ||
enum Entrypoint { | ||
static func main() async throws { | ||
var env = try Environment.detect() | ||
try LoggingSystem.bootstrap(from: &env) | ||
|
||
let app = Application(env) | ||
defer { app.shutdown() } | ||
|
||
do { | ||
try await configure(app) | ||
} catch { | ||
app.logger.report(error: error) | ||
throw error | ||
} | ||
|
||
try await app.runFromAsyncMainEntrypoint() | ||
} | ||
} | ||
|
||
|
This file was deleted.
Oops, something went wrong.