Skip to content

Commit

Permalink
refactor: change error description
Browse files Browse the repository at this point in the history
  • Loading branch information
gulivero1773 committed Apr 29, 2024
1 parent c6a7f29 commit 6f82c28
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public struct PostgresHealthChecks: PostgresHealthChecksProtocol {
/// - Returns: `String`
public func checkConnection() async -> String {
guard let result = try? await app.psqlRequest?.checkConnection(for: postgresDatabase) else {
return "ERROR: No connect to Postgres database"
return "ERROR: No connect to Postgres database for check database"
}
return result
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public struct PsqlRequest: PsqlRequestSendable {
public func checkConnection(for databaseName: String) async throws -> String {
let rows = try? await (app.db(.psql) as? PostgresDatabase)?.simpleQuery("SELECT * FROM pg_stat_activity WHERE datname = '\(databaseName)' and state = 'active';").get()
let row = rows?.first?.makeRandomAccess()
var connectionDescription = "ERROR: No connect to Postgres database"
var connectionDescription = "ERROR: No connect to Postgres database and not check state connection"
if let result = (row?[data: "state"].string) {
connectionDescription = result
}
Expand Down

0 comments on commit 6f82c28

Please sign in to comment.