소스 검색

db: skip ping when not available (#6687)

Joe Chen 3 년 전
부모
커밋
7878465567
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      internal/db/models.go

+ 3 - 0
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()
 }