Chore: Remove Store interface and use db.DB instead (#60160)

* Chore: Remove Store interface and use db.DB instead

* use old-style session exec
This commit is contained in:
Serge Zaitsev
2022-12-13 11:03:36 +01:00
committed by GitHub
parent 4c4bc3bd32
commit af7d293eaf
13 changed files with 27 additions and 53 deletions
+6 -2
View File
@@ -4,7 +4,7 @@ import (
"context"
"time"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/infra/db"
)
func (hs *HTTPServer) databaseHealthy(ctx context.Context) bool {
@@ -14,7 +14,11 @@ func (hs *HTTPServer) databaseHealthy(ctx context.Context) bool {
return cached.(bool)
}
healthy := hs.SQLStore.GetDBHealthQuery(ctx, &models.GetDBHealthQuery{}) == nil
err := hs.SQLStore.WithDbSession(ctx, func(session *db.Session) error {
_, err := session.Exec("SELECT 1")
return err
})
healthy := err == nil
hs.CacheService.Set(cacheKey, healthy, time.Second*5)
return healthy