Browse Source

db: skip ping when not available (#6687)

Joe Chen 3 năm trước cách đây
mục cha
commit
7878465567
1 tập tin đã thay đổi với 3 bổ sung0 xóa
  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()
 }