From 1c57b538be07fbb6b2f8d6b17cc9c865bd960d38 Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Tue, 19 Dec 2023 20:45:16 +0100 Subject: [PATCH] Display environment on startup --- Sources/App/EventLoopScheduler.swift | 3 +++ Sources/App/configure.swift | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Sources/App/EventLoopScheduler.swift b/Sources/App/EventLoopScheduler.swift index b21c496..10d9cc6 100644 --- a/Sources/App/EventLoopScheduler.swift +++ b/Sources/App/EventLoopScheduler.swift @@ -4,6 +4,9 @@ import Vapor import NIOCore extension MultiThreadedEventLoopGroup: AsyncScheduler { + + func test() { + } public func schedule(asyncJob: @escaping @Sendable () async throws -> Void) { _ = any().makeFutureWithTask(asyncJob) diff --git a/Sources/App/configure.swift b/Sources/App/configure.swift index 7d8c5eb..0c0dc25 100755 --- a/Sources/App/configure.swift +++ b/Sources/App/configure.swift @@ -58,12 +58,12 @@ func configure(_ app: Application) async throws { } else { try await serverStatus.update(.reducedFunctionality) } - print("[\(df.string(from: Date()))] Server started (\(server.capCount) caps)") + print("[\(df.string(from: Date()))] Server started (\(app.environment.name), \(server.capCount) caps)") } func shutdown() { - print("[\(df.string(from: Date()))] Server shutdown") - asyncScheduler.schedule { + Task { + print("[\(df.string(from: Date()))] Server shutdown") do { try await asyncScheduler.shutdownGracefully() } catch {