Fix db health check

This commit is contained in:
Hubert Van De Walle 2020-11-05 15:34:37 +01:00
parent 568a2c6831
commit e6a7af840a
2 changed files with 3 additions and 6 deletions

View File

@ -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
}
}