Chore: Add context to datasource service (#42294)

* Add context to datasource service

* Adjust wire for ShouldBeReported method

* Replace inTransactionCtx
This commit is contained in:
idafurjes
2021-11-26 18:10:36 +01:00
committed by GitHub
parent 6aa05c5d05
commit 725dbf8d95
12 changed files with 69 additions and 64 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ var datasourcesLogger = log.New("datasources")
func (hs *HTTPServer) GetDataSources(c *models.ReqContext) response.Response {
query := models.GetDataSourcesQuery{OrgId: c.OrgId, DataSourceLimit: hs.Cfg.DataSourceLimit}
if err := bus.Dispatch(&query); err != nil {
if err := bus.DispatchCtx(c.Req.Context(), &query); err != nil {
return response.Error(500, "Failed to query datasources", err)
}
+2 -2
View File
@@ -25,7 +25,7 @@ func (hs *HTTPServer) getFSDataSources(c *models.ReqContext, enabledPlugins Enab
if c.OrgId != 0 {
query := models.GetDataSourcesQuery{OrgId: c.OrgId, DataSourceLimit: hs.Cfg.DataSourceLimit}
err := bus.Dispatch(&query)
err := bus.DispatchCtx(c.Req.Context(), &query)
if err != nil {
return nil, err
@@ -36,7 +36,7 @@ func (hs *HTTPServer) getFSDataSources(c *models.ReqContext, enabledPlugins Enab
Datasources: query.Result,
}
if err := bus.Dispatch(&dsFilterQuery); err != nil {
if err := bus.DispatchCtx(c.Req.Context(), &dsFilterQuery); err != nil {
if !errors.Is(err, bus.ErrHandlerNotFound) {
return nil, err
}