Fixing problem with read-replica on indexing files (#17460)

Этот коммит содержится в:
Jesús Espino
2021-04-20 12:30:43 +02:00
коммит произвёл GitHub
родитель 4295a1f556
Коммит 368b642105
7 изменённых файлов: 95 добавлений и 4 удалений

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

@@ -3370,6 +3370,26 @@ func (s *RetryLayerFileInfoStore) GetForUser(userID string) ([]*model.FileInfo,
}
func (s *RetryLayerFileInfoStore) GetFromMaster(id string) (*model.FileInfo, error) {
tries := 0
for {
result, err := s.FileInfoStore.GetFromMaster(id)
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 *RetryLayerFileInfoStore) GetWithOptions(page int, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, error) {
tries := 0