MM-32693: Use master when emoji_layer is invalidated (#16951)
We add a map which tracks invalidations to the emoji caches and use master whenever a fresh item is fetched from DB. https://mattermost.atlassian.net/browse/MM-32693 ```release-note NONE ``` Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
33c8b0ad73
Коммит
6dcbad049c
@@ -2807,7 +2807,7 @@ func (s *OpenTracingLayerEmojiStore) Delete(emoji *model.Emoji, time int64) erro
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerEmojiStore) Get(id string, allowFromCache bool) (*model.Emoji, error) {
|
||||
func (s *OpenTracingLayerEmojiStore) Get(ctx context.Context, id string, allowFromCache bool) (*model.Emoji, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "EmojiStore.Get")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -2816,7 +2816,7 @@ func (s *OpenTracingLayerEmojiStore) Get(id string, allowFromCache bool) (*model
|
||||
}()
|
||||
|
||||
defer span.Finish()
|
||||
result, err := s.EmojiStore.Get(id, allowFromCache)
|
||||
result, err := s.EmojiStore.Get(ctx, id, allowFromCache)
|
||||
if err != nil {
|
||||
span.LogFields(spanlog.Error(err))
|
||||
ext.Error.Set(span, true)
|
||||
@@ -2825,7 +2825,7 @@ func (s *OpenTracingLayerEmojiStore) Get(id string, allowFromCache bool) (*model
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerEmojiStore) GetByName(name string, allowFromCache bool) (*model.Emoji, error) {
|
||||
func (s *OpenTracingLayerEmojiStore) GetByName(ctx context.Context, name string, allowFromCache bool) (*model.Emoji, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "EmojiStore.GetByName")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -2834,7 +2834,7 @@ func (s *OpenTracingLayerEmojiStore) GetByName(name string, allowFromCache bool)
|
||||
}()
|
||||
|
||||
defer span.Finish()
|
||||
result, err := s.EmojiStore.GetByName(name, allowFromCache)
|
||||
result, err := s.EmojiStore.GetByName(ctx, name, allowFromCache)
|
||||
if err != nil {
|
||||
span.LogFields(spanlog.Error(err))
|
||||
ext.Error.Set(span, true)
|
||||
|
||||
Ссылка в новой задаче
Block a user