Chore: Remove Dispatch and AddHandler (#42603)

* Remove Dispatch

* Remove context.TODO()

* Remove AddHandler and Dispatch
This commit is contained in:
idafurjes
2021-12-02 18:08:59 +01:00
committed by GitHub
parent e79fe8e84e
commit c80e7764d8
28 changed files with 83 additions and 129 deletions
+3 -3
View File
@@ -33,7 +33,7 @@ type DashboardProvisioningService interface {
SaveFolderForProvisionedDashboards(context.Context, *SaveDashboardDTO) (*models.Dashboard, error)
GetProvisionedDashboardData(name string) ([]*models.DashboardProvisioning, error)
GetProvisionedDashboardDataByDashboardID(dashboardID int64) (*models.DashboardProvisioning, error)
UnprovisionDashboard(dashboardID int64) error
UnprovisionDashboard(ctx context.Context, dashboardID int64) error
DeleteProvisionedDashboard(ctx context.Context, dashboardID int64, orgID int64) error
}
@@ -346,9 +346,9 @@ func (dr *dashboardServiceImpl) ImportDashboard(ctx context.Context, dto *SaveDa
// UnprovisionDashboard removes info about dashboard being provisioned. Used after provisioning configs are changed
// and provisioned dashboards are left behind but not deleted.
func (dr *dashboardServiceImpl) UnprovisionDashboard(dashboardId int64) error {
func (dr *dashboardServiceImpl) UnprovisionDashboard(ctx context.Context, dashboardId int64) error {
cmd := &models.UnprovisionDashboardCommand{Id: dashboardId}
return bus.Dispatch(cmd)
return bus.DispatchCtx(ctx, cmd)
}
type FakeDashboardService struct {
+1 -1
View File
@@ -209,7 +209,7 @@ func (dr *dashboardServiceImpl) DeleteFolder(ctx context.Context, uid string, fo
}
deleteCmd := models.DeleteDashboardCommand{OrgId: dr.orgId, Id: dashFolder.Id, ForceDeleteFolderRules: forceDeleteRules}
if err := bus.Dispatch(&deleteCmd); err != nil {
if err := bus.DispatchCtx(ctx, &deleteCmd); err != nil {
return nil, toFolderError(err)
}