Add top DMs route and handlers

Этот коммит содержится в:
Shivashis Padhi
2022-06-22 16:11:40 +05:30
родитель 56cf4b4ee7
Коммит 0ab2189941
11 изменённых файлов: 226 добавлений и 0 удалений

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

@@ -6806,6 +6806,27 @@ func (s *RetryLayerPostStore) GetSingle(id string, inclDeleted bool) (*model.Pos
}
func (s *RetryLayerPostStore) GetTopDMsForUserSince(userID string, since int64, offset int, limit int) (*model.TopDMList, error) {
tries := 0
for {
result, err := s.PostStore.GetTopDMsForUserSince(userID, since, offset, limit)
if err == nil {
return result, nil
}
if !isRepeatableError(err) {
return result, err
}
tries++
if tries >= 3 {
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
return result, err
}
timepkg.Sleep(100 * timepkg.Millisecond)
}
}
func (s *RetryLayerPostStore) HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userId string) (bool, error) {
tries := 0