[MM-32281] SqlRoleStore/GetByName: add context to allow read from master (#17176)

* role_store/GetByName: add context

* propagate context in the app layer

* propagate context in the app layer

* add missing import

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2021-04-21 18:01:02 +03:00
коммит произвёл GitHub
родитель 9eceeaa8db
Коммит 28ff4dc8d0
37 изменённых файлов: 225 добавлений и 198 удалений

Просмотреть файл

@@ -6559,7 +6559,7 @@ func (s *OpenTracingLayerRoleStore) GetAll() ([]*model.Role, error) {
return result, err
}
func (s *OpenTracingLayerRoleStore) GetByName(name string) (*model.Role, error) {
func (s *OpenTracingLayerRoleStore) GetByName(ctx context.Context, name string) (*model.Role, error) {
origCtx := s.Root.Store.Context()
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "RoleStore.GetByName")
s.Root.Store.SetContext(newCtx)
@@ -6568,7 +6568,7 @@ func (s *OpenTracingLayerRoleStore) GetByName(name string) (*model.Role, error)
}()
defer span.Finish()
result, err := s.RoleStore.GetByName(name)
result, err := s.RoleStore.GetByName(ctx, name)
if err != nil {
span.LogFields(spanlog.Error(err))
ext.Error.Set(span, true)