Skip to content

Commit

Permalink
fix: change connectingTo to lazyConnectingTo
Browse files Browse the repository at this point in the history
  • Loading branch information
gulivero1773 committed Jun 3, 2024
1 parent af56f76 commit 76d5fe3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/HealthChecks/MongoHealthChecks/MongoRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public struct MongoRequest: MongoRequestSendable {
/// - Parameter url: `String`
/// - Returns: `String`
public func getConnection(by url: String) async throws -> String {
app.mongoCluster = try? await MongoCluster(connectingTo: ConnectionSettings(url))
await app.mongoCluster?.disconnect()
app.mongoCluster = try? MongoCluster(lazyConnectingTo: ConnectionSettings(url))
let connection = "\(app.mongoCluster?.connectionState ?? .disconnected)"
await app.mongoCluster?.disconnect()
return connection
Expand Down

0 comments on commit 76d5fe3

Please sign in to comment.