aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2021-12-20 18:46:54 +0800
committerGitHub <noreply@github.com>2021-12-20 18:46:54 +0800
commit7878465567e160786070d00db9aabd03f88a9191 (patch)
treea5fbfb69e32cfa7ea595b33a004361882786ae91 /internal
parentc82dc04cbb7b3da9a42dce6953ab1dceed355f14 (diff)
db: skip ping when not available (#6687)
Diffstat (limited to 'internal')
-rw-r--r--internal/db/models.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/db/models.go b/internal/db/models.go
index 3c2b6280..6e4fd2a7 100644
--- a/internal/db/models.go
+++ b/internal/db/models.go
@@ -231,6 +231,9 @@ func GetStatistic() (stats Statistic) {
}
func Ping() error {
+ if x == nil {
+ return errors.New("database not available")
+ }
return x.Ping()
}