3
0
mirror of https://github.com/grafana/grafana.git synced 2025-02-25 18:55:37 -06:00

SQLStore: Fix race condition in RecursiveQueriesAreSupported ()

This commit is contained in:
George Robinson 2023-09-22 11:30:14 +01:00 committed by GitHub
parent c78d5fa4e3
commit 15f6e8a500
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,6 +55,7 @@ type SQLStore struct {
migrations registry.DatabaseMigrator
tracer tracing.Tracer
recursiveQueriesAreSupported *bool
recursiveQueriesMu sync.Mutex
}
func ProvideService(cfg *setting.Cfg, cacheService *localcache.CacheService, migrations registry.DatabaseMigrator, bus bus.Bus, tracer tracing.Tracer) (*SQLStore, error) {
@ -524,6 +525,8 @@ func (ss *SQLStore) GetMigrationLockAttemptTimeout() int {
}
func (ss *SQLStore) RecursiveQueriesAreSupported() (bool, error) {
ss.recursiveQueriesMu.Lock()
defer ss.recursiveQueriesMu.Unlock()
if ss.recursiveQueriesAreSupported != nil {
return *ss.recursiveQueriesAreSupported, nil
}