Chore: Propagate context for data source provisioning (#40235)
* context all the things * apply feedback * rollback some alerting changes * rollback some alerting changes #2 * more rollbacks * more rollbacks #2 * more rollbacks #3 * more rollbacks #4 * fix integration test * add missing context * add missing and remove incorrect dispatch
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package datasources
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
@@ -45,7 +46,7 @@ func (dc *CacheServiceImpl) GetDatasource(
|
||||
plog.Debug("Querying for data source via SQL store", "id", datasourceID, "orgId", user.OrgId)
|
||||
|
||||
query := &models.GetDataSourceQuery{Id: datasourceID, OrgId: user.OrgId}
|
||||
err := dc.SQLStore.GetDataSource(query)
|
||||
err := dc.SQLStore.GetDataSource(context.TODO(), query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -83,7 +84,7 @@ func (dc *CacheServiceImpl) GetDatasourceByUID(
|
||||
|
||||
plog.Debug("Querying for data source via SQL store", "uid", datasourceUID, "orgId", user.OrgId)
|
||||
query := &models.GetDataSourceQuery{Uid: datasourceUID, OrgId: user.OrgId}
|
||||
err := dc.SQLStore.GetDataSource(query)
|
||||
err := dc.SQLStore.GetDataSource(context.TODO(), query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -64,17 +64,17 @@ func ProvideService(bus bus.Bus, store *sqlstore.SQLStore, encryptionService enc
|
||||
|
||||
s.Bus.AddHandler(s.GetDataSources)
|
||||
s.Bus.AddHandler(s.GetDataSourcesByType)
|
||||
s.Bus.AddHandler(s.GetDataSource)
|
||||
s.Bus.AddHandlerCtx(s.GetDataSource)
|
||||
s.Bus.AddHandlerCtx(s.AddDataSource)
|
||||
s.Bus.AddHandler(s.DeleteDataSource)
|
||||
s.Bus.AddHandlerCtx(s.DeleteDataSource)
|
||||
s.Bus.AddHandlerCtx(s.UpdateDataSource)
|
||||
s.Bus.AddHandler(s.GetDefaultDataSource)
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *Service) GetDataSource(query *models.GetDataSourceQuery) error {
|
||||
return s.SQLStore.GetDataSource(query)
|
||||
func (s *Service) GetDataSource(ctx context.Context, query *models.GetDataSourceQuery) error {
|
||||
return s.SQLStore.GetDataSource(ctx, query)
|
||||
}
|
||||
|
||||
func (s *Service) GetDataSources(query *models.GetDataSourcesQuery) error {
|
||||
@@ -92,11 +92,11 @@ func (s *Service) AddDataSource(ctx context.Context, cmd *models.AddDataSourceCo
|
||||
return err
|
||||
}
|
||||
|
||||
return s.SQLStore.AddDataSource(cmd)
|
||||
return s.SQLStore.AddDataSource(ctx, cmd)
|
||||
}
|
||||
|
||||
func (s *Service) DeleteDataSource(cmd *models.DeleteDataSourceCommand) error {
|
||||
return s.SQLStore.DeleteDataSource(cmd)
|
||||
func (s *Service) DeleteDataSource(ctx context.Context, cmd *models.DeleteDataSourceCommand) error {
|
||||
return s.SQLStore.DeleteDataSource(ctx, cmd)
|
||||
}
|
||||
|
||||
func (s *Service) UpdateDataSource(ctx context.Context, cmd *models.UpdateDataSourceCommand) error {
|
||||
@@ -106,7 +106,7 @@ func (s *Service) UpdateDataSource(ctx context.Context, cmd *models.UpdateDataSo
|
||||
return err
|
||||
}
|
||||
|
||||
return s.SQLStore.UpdateDataSource(cmd)
|
||||
return s.SQLStore.UpdateDataSource(ctx, cmd)
|
||||
}
|
||||
|
||||
func (s *Service) GetDefaultDataSource(query *models.GetDefaultDataSourceQuery) error {
|
||||
|
||||
Reference in New Issue
Block a user