diff --git a/pkg/bus/bus.go b/pkg/bus/bus.go index 18248d6667e..a7d580ef2b1 100644 --- a/pkg/bus/bus.go +++ b/pkg/bus/bus.go @@ -28,7 +28,7 @@ type Bus interface { InTransaction(ctx context.Context, fn func(ctx context.Context) error) error AddHandler(handler HandlerFunc) - AddCtxHandler(handler HandlerFunc) + AddHandlerCtx(handler HandlerFunc) AddEventListener(handler HandlerFunc) AddWildcardListener(handler HandlerFunc) @@ -146,7 +146,7 @@ func (b *InProcBus) AddHandler(handler HandlerFunc) { b.handlers[queryTypeName] = handler } -func (b *InProcBus) AddCtxHandler(handler HandlerFunc) { +func (b *InProcBus) AddHandlerCtx(handler HandlerFunc) { handlerType := reflect.TypeOf(handler) queryTypeName := handlerType.In(1).Elem().Name() b.handlers[queryTypeName] = handler @@ -168,8 +168,8 @@ func AddHandler(implName string, handler HandlerFunc) { } // Package level functions -func AddCtxHandler(implName string, handler HandlerFunc) { - globalBus.AddCtxHandler(handler) +func AddHandlerCtx(implName string, handler HandlerFunc) { + globalBus.AddHandlerCtx(handler) } // Package level functions diff --git a/pkg/services/notifications/notifications.go b/pkg/services/notifications/notifications.go index 14d362c5e1e..fcefa91243d 100644 --- a/pkg/services/notifications/notifications.go +++ b/pkg/services/notifications/notifications.go @@ -45,8 +45,8 @@ func (ns *NotificationService) Init() error { ns.Bus.AddHandler(ns.validateResetPasswordCode) ns.Bus.AddHandler(ns.sendEmailCommandHandler) - ns.Bus.AddCtxHandler(ns.sendEmailCommandHandlerSync) - ns.Bus.AddCtxHandler(ns.SendWebhookSync) + ns.Bus.AddHandlerCtx(ns.sendEmailCommandHandlerSync) + ns.Bus.AddHandlerCtx(ns.SendWebhookSync) ns.Bus.AddEventListener(ns.signUpStartedHandler) ns.Bus.AddEventListener(ns.signUpCompletedHandler) diff --git a/pkg/services/sqlstore/stats.go b/pkg/services/sqlstore/stats.go index af4482d9e25..ef0f148bb2a 100644 --- a/pkg/services/sqlstore/stats.go +++ b/pkg/services/sqlstore/stats.go @@ -14,7 +14,7 @@ func init() { bus.AddHandler("sql", GetDataSourceAccessStats) bus.AddHandler("sql", GetAdminStats) bus.AddHandler("sql", GetSystemUserCountStats) - bus.AddCtxHandler("sql", GetSystemUserCountStatsCtx) + bus.AddHandlerCtx("sql", GetSystemUserCountStatsCtx) } var activeUserTimeLimit = time.Hour * 24 * 30 diff --git a/pkg/services/sqlstore/user.go b/pkg/services/sqlstore/user.go index f01cb84ad4f..252499d5fdc 100644 --- a/pkg/services/sqlstore/user.go +++ b/pkg/services/sqlstore/user.go @@ -31,7 +31,7 @@ func init() { bus.AddHandler("sql", DeleteUser) bus.AddHandler("sql", UpdateUserPermissions) bus.AddHandler("sql", SetUserHelpFlag) - bus.AddCtxHandler("sql", CreateUserCtx) + bus.AddHandlerCtx("sql", CreateUserCtx) } func getOrgIdForNewUser(cmd *m.CreateUserCommand, sess *DBSession) (int64, error) {