Skip to content

Commit

Permalink
fix: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gulivero1773 committed Jun 5, 2024
1 parent 3e12262 commit 4e407dc
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Sources/HealthChecks/MongoHealthChecks/MongoRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ public final class MongoRequest: MongoRequestSendable {
/// - Parameter url: `String`
/// - Returns: `String`
public func getConnection(by url: String) async throws -> String {
await app.mongoCluster?.disconnect()
app.mongoCluster = nil
app.mongoCluster = try? MongoCluster(lazyConnectingTo: ConnectionSettings(url))
let connection = "\(app.mongoCluster?.connectionState ?? .disconnected)"
await app.mongoCluster?.disconnect()
app.mongoCluster = nil
let connect = try await app.client.get(URI(string: url))
// await app.mongoCluster?.disconnect()
// app.mongoCluster = nil
// app.mongoCluster = try? MongoCluster(lazyConnectingTo: ConnectionSettings(url))
// let connection = "\(app.mongoCluster?.connectionState ?? .disconnected)"
// await app.mongoCluster?.disconnect()
// app.mongoCluster = nil

return connection
return "\(connect.status)"
}
}

0 comments on commit 4e407dc

Please sign in to comment.