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>
Этот коммит содержится в:
Agniva De Sarker
2021-02-26 22:17:51 +05:30
коммит произвёл GitHub
родитель 33c8b0ad73
Коммит 6dcbad049c
14 изменённых файлов: 169 добавлений и 84 удалений

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

@@ -3004,11 +3004,11 @@ func (s *RetryLayerEmojiStore) Delete(emoji *model.Emoji, time int64) error {
}
func (s *RetryLayerEmojiStore) Get(id string, allowFromCache bool) (*model.Emoji, error) {
func (s *RetryLayerEmojiStore) Get(ctx context.Context, id string, allowFromCache bool) (*model.Emoji, error) {
tries := 0
for {
result, err := s.EmojiStore.Get(id, allowFromCache)
result, err := s.EmojiStore.Get(ctx, id, allowFromCache)
if err == nil {
return result, nil
}
@@ -3024,11 +3024,11 @@ func (s *RetryLayerEmojiStore) Get(id string, allowFromCache bool) (*model.Emoji
}
func (s *RetryLayerEmojiStore) GetByName(name string, allowFromCache bool) (*model.Emoji, error) {
func (s *RetryLayerEmojiStore) GetByName(ctx context.Context, name string, allowFromCache bool) (*model.Emoji, error) {
tries := 0
for {
result, err := s.EmojiStore.GetByName(name, allowFromCache)
result, err := s.EmojiStore.GetByName(ctx, name, allowFromCache)
if err == nil {
return result, nil
}