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 удалений

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

@@ -2575,10 +2575,10 @@ func (s *TimerLayerEmojiStore) Delete(emoji *model.Emoji, time int64) error {
return err
}
func (s *TimerLayerEmojiStore) Get(id string, allowFromCache bool) (*model.Emoji, error) {
func (s *TimerLayerEmojiStore) Get(ctx context.Context, id string, allowFromCache bool) (*model.Emoji, error) {
start := timemodule.Now()
result, err := s.EmojiStore.Get(id, allowFromCache)
result, err := s.EmojiStore.Get(ctx, id, allowFromCache)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
@@ -2591,10 +2591,10 @@ func (s *TimerLayerEmojiStore) Get(id string, allowFromCache bool) (*model.Emoji
return result, err
}
func (s *TimerLayerEmojiStore) GetByName(name string, allowFromCache bool) (*model.Emoji, error) {
func (s *TimerLayerEmojiStore) GetByName(ctx context.Context, name string, allowFromCache bool) (*model.Emoji, error) {
start := timemodule.Now()
result, err := s.EmojiStore.GetByName(name, allowFromCache)
result, err := s.EmojiStore.GetByName(ctx, name, allowFromCache)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {