Skip to content

Commit

Permalink
Wait for lifecycle shutdown to finish (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler authored Feb 21, 2023
1 parent 9042192 commit b9bdaf7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Sources/Hummingbird/Application.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,12 @@ public final class HBApplication: HBExtensible {

/// Shutdown application
public func stop() {
self.lifecycle.shutdown()
let stopSemaphore = DispatchSemaphore(value: 0)

self.lifecycle.shutdown { _ in
stopSemaphore.signal()
}
stopSemaphore.wait()
}

/// middleware applied to requests
Expand Down

0 comments on commit b9bdaf7

Please sign in to comment.