[MM-39631] mirgate user store to sqlx (#19403)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Kirill Krotov
2022-02-09 17:26:16 +03:00
коммит произвёл GitHub
родитель d5b24e383d
Коммит 440790dad6
10 изменённых файлов: 258 добавлений и 127 удалений

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

@@ -11977,6 +11977,27 @@ func (s *RetryLayerUserStore) InferSystemInstallDate() (int64, error) {
}
func (s *RetryLayerUserStore) InsertUsers(users []*model.User) error {
tries := 0
for {
err := s.UserStore.InsertUsers(users)
if err == nil {
return nil
}
if !isRepeatableError(err) {
return err
}
tries++
if tries >= 3 {
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
return err
}
timepkg.Sleep(100 * timepkg.Millisecond)
}
}
func (s *RetryLayerUserStore) InvalidateProfileCacheForUser(userID string) {
s.UserStore.InvalidateProfileCacheForUser(userID)