MM-35396 Refactor GetThreadForUser store func to take membership as argument to prevent replica lag issues and reduce joins in query (#17754)

* Update store function GetThreadForUser to use master DB to fix replica lag

* Refactor GetThreadForUser store func to take membership as argument to prevent replica lag issues and reduce joins in query

* Add translation

* Fix test

* Updates per feedback

* Minor clean-up per feedback
Этот коммит содержится в:
Joram Wilander
2021-06-14 12:33:08 -04:00
коммит произвёл GitHub
родитель 24fb0033f4
Коммит d0778486ad
16 изменённых файлов: 119 добавлений и 46 удалений

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

@@ -7990,10 +7990,10 @@ func (s *TimerLayerThreadStore) GetThreadFollowers(threadID string) ([]string, e
return result, err
}
func (s *TimerLayerThreadStore) GetThreadForUser(userID string, teamID string, threadId string, extended bool) (*model.ThreadResponse, error) {
func (s *TimerLayerThreadStore) GetThreadForUser(teamID string, threadMembership *model.ThreadMembership, extended bool) (*model.ThreadResponse, error) {
start := timemodule.Now()
result, err := s.ThreadStore.GetThreadForUser(userID, teamID, threadId, extended)
result, err := s.ThreadStore.GetThreadForUser(teamID, threadMembership, extended)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {