Fix db health check
This commit is contained in:
parent
568a2c6831
commit
e6a7af840a
@ -8,6 +8,6 @@ interface HealthCheckService {
|
||||
}
|
||||
|
||||
@Singleton
|
||||
class HealthCheckServiceImpl(private val dbHealthCheck: DbHealthCheck): HealthCheckService {
|
||||
class HealthCheckServiceImpl(private val dbHealthCheck: DbHealthCheck) : HealthCheckService {
|
||||
override fun isOk() = dbHealthCheck.isOk()
|
||||
}
|
||||
|
||||
@ -6,8 +6,7 @@ import be.simplenotes.persistance.utils.type
|
||||
import me.liuwj.ktorm.database.Database
|
||||
import me.liuwj.ktorm.database.asIterable
|
||||
import me.liuwj.ktorm.database.use
|
||||
import java.io.EOFException
|
||||
import java.sql.SQLTransientException
|
||||
import java.sql.SQLException
|
||||
import javax.inject.Singleton
|
||||
|
||||
interface DbHealthCheck {
|
||||
@ -26,9 +25,7 @@ internal class DbHealthCheckImpl(
|
||||
it.executeQuery().asIterable().map { it.getString(1) }
|
||||
}
|
||||
}.any { it in dataSourceConfig.jdbcUrl }
|
||||
} catch (e: SQLTransientException) {
|
||||
false
|
||||
} catch (e: EOFException) {
|
||||
} catch (e: SQLException) {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user