Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asyncBoot will no longer try booting server again if it is already booted #3195

Merged
merged 4 commits into from
May 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Sources/Vapor/Application.swift
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,17 @@ public final class Application: Sendable {

/// Called when the applications starts up, will trigger the lifecycle handlers. The asynchronous version of ``boot()``
public func asyncBoot() async throws {
self.isBooted.withLockedValue { booted in
guard !booted else {
return
let notBooted = self.isBooted.withLockedValue { booted in
guard booted else {
booted = true
return true
}
booted = true

return false
}

guard notBooted else { return }

RussBaz marked this conversation as resolved.
Show resolved Hide resolved
for handler in self.lifecycle.handlers {
try await handler.willBootAsync(self)
}
Expand Down