Sfoglia il codice sorgente

db: skip ping when not available (#6687)

Joe Chen 3 anni fa
parent
commit
7878465567
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  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()
 }