Poststore migration part3 (#15505)
* Migration completed * Order in translations file * Fix: lints * Trigger CI * Fix message key * Change mlog.Error for mlog.Warn * Fix imports * Adding translations needed for EE * Trigger CI * Fix merge with master Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in> Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
cd7d68effb
Коммит
8118cac350
@@ -4070,21 +4070,63 @@ func (s *RetryLayerPluginStore) SetWithOptions(pluginId string, key string, valu
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) (int64, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) (int64, error) {
|
||||
|
||||
return s.PostStore.AnalyticsPostCount(teamId, mustHaveFile, mustHaveHashtag)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.AnalyticsPostCount(teamId, mustHaveFile, mustHaveHashtag)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, error) {
|
||||
|
||||
return s.PostStore.AnalyticsPostCountsByDay(options)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.AnalyticsPostCountsByDay(options)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.AnalyticsRows, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.AnalyticsRows, error) {
|
||||
|
||||
return s.PostStore.AnalyticsUserCountsWithPostsByDay(teamId)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.AnalyticsUserCountsWithPostsByDay(teamId)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4134,9 +4176,23 @@ func (s *RetryLayerPostStore) Get(id string, skipFetchThreads bool) (*model.Post
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetDirectPostParentsForExportAfter(limit int, afterId string) ([]*model.DirectPostForExport, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetDirectPostParentsForExportAfter(limit int, afterId string) ([]*model.DirectPostForExport, error) {
|
||||
|
||||
return s.PostStore.GetDirectPostParentsForExportAfter(limit, afterId)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetDirectPostParentsForExportAfter(limit, afterId)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4212,21 +4268,63 @@ func (s *RetryLayerPostStore) GetMaxPostSize() int {
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetOldest() (*model.Post, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetOldest() (*model.Post, error) {
|
||||
|
||||
return s.PostStore.GetOldest()
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetOldest()
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetOldestEntityCreationTime() (int64, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetOldestEntityCreationTime() (int64, error) {
|
||||
|
||||
return s.PostStore.GetOldestEntityCreationTime()
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetOldestEntityCreationTime()
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetParentsForExportAfter(limit int, afterId string) ([]*model.PostForExport, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetParentsForExportAfter(limit int, afterId string) ([]*model.PostForExport, error) {
|
||||
|
||||
return s.PostStore.GetParentsForExportAfter(limit, afterId)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetParentsForExportAfter(limit, afterId)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4290,9 +4388,23 @@ func (s *RetryLayerPostStore) GetPostIdBeforeTime(channelId string, time int64)
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetPosts(options model.GetPostsOptions, allowFromCache bool) (*model.PostList, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetPosts(options model.GetPostsOptions, allowFromCache bool) (*model.PostList, error) {
|
||||
|
||||
return s.PostStore.GetPosts(options, allowFromCache)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetPosts(options, allowFromCache)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4316,9 +4428,23 @@ func (s *RetryLayerPostStore) GetPostsAfter(options model.GetPostsOptions) (*mod
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.PostForIndexing, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.PostForIndexing, error) {
|
||||
|
||||
return s.PostStore.GetPostsBatchForIndexing(startTime, endTime, limit)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetPostsBatchForIndexing(startTime, endTime, 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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4342,15 +4468,43 @@ func (s *RetryLayerPostStore) GetPostsBefore(options model.GetPostsOptions) (*mo
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetPostsByIds(postIds []string) ([]*model.Post, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetPostsByIds(postIds []string) ([]*model.Post, error) {
|
||||
|
||||
return s.PostStore.GetPostsByIds(postIds)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetPostsByIds(postIds)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetPostsCreatedAt(channelId string, time int64) ([]*model.Post, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetPostsCreatedAt(channelId string, time int64) ([]*model.Post, error) {
|
||||
|
||||
return s.PostStore.GetPostsCreatedAt(channelId, time)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetPostsCreatedAt(channelId, time)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4374,9 +4528,23 @@ func (s *RetryLayerPostStore) GetPostsSince(options model.GetPostsSinceOptions,
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) GetRepliesForExport(parentId string) ([]*model.ReplyForExport, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) GetRepliesForExport(parentId string) ([]*model.ReplyForExport, error) {
|
||||
|
||||
return s.PostStore.GetRepliesForExport(parentId)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.GetRepliesForExport(parentId)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4406,21 +4574,63 @@ func (s *RetryLayerPostStore) InvalidateLastPostTimeCache(channelId string) {
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) Overwrite(post *model.Post) (*model.Post, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) Overwrite(post *model.Post) (*model.Post, error) {
|
||||
|
||||
return s.PostStore.Overwrite(post)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.Overwrite(post)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, error) {
|
||||
|
||||
return s.PostStore.OverwriteMultiple(posts)
|
||||
tries := 0
|
||||
for {
|
||||
result, resultVar1, err := s.PostStore.OverwriteMultiple(posts)
|
||||
if err == nil {
|
||||
return result, resultVar1, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, resultVar1, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, resultVar1, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) {
|
||||
|
||||
return s.PostStore.PermanentDeleteBatch(endTime, limit)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.PermanentDeleteBatch(endTime, 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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4504,15 +4714,43 @@ func (s *RetryLayerPostStore) SaveMultiple(posts []*model.Post) ([]*model.Post,
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) Search(teamId string, userId string, params *model.SearchParams) (*model.PostList, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) Search(teamId string, userId string, params *model.SearchParams) (*model.PostList, error) {
|
||||
|
||||
return s.PostStore.Search(teamId, userId, params)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.Search(teamId, userId, params)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId string, teamId string, page int, perPage int) (*model.PostSearchResults, *model.AppError) {
|
||||
func (s *RetryLayerPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId string, teamId string, page int, perPage int) (*model.PostSearchResults, error) {
|
||||
|
||||
return s.PostStore.SearchPostsInTeamForUser(paramsList, userId, teamId, page, perPage)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.PostStore.SearchPostsInTeamForUser(paramsList, userId, teamId, page, perPage)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user