GH-11469 Migrate User.UpdateLastPictureUpdate to Sync by default (#11493)

* GH-11469 Migrate User.UpdateLastPictureUpdate to Sync by default

* GH-11469 log error on failure
Этот коммит содержится в:
Marc Argent
2019-07-04 13:59:10 +01:00
коммит произвёл Jesús Espino
родитель 68703f9b76
Коммит 2f9d509284
5 изменённых файлов: 16 добавлений и 16 удалений

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

@@ -212,16 +212,14 @@ func (us SqlUserStore) Update(user *model.User, trustedUpdateData bool) (*model.
return &model.UserUpdate{New: user, Old: oldUser}, nil
}
func (us SqlUserStore) UpdateLastPictureUpdate(userId string) store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
curTime := model.GetMillis()
func (us SqlUserStore) UpdateLastPictureUpdate(userId string) *model.AppError {
curTime := model.GetMillis()
if _, err := us.GetMaster().Exec("UPDATE Users SET LastPictureUpdate = :Time, UpdateAt = :Time WHERE Id = :UserId", map[string]interface{}{"Time": curTime, "UserId": userId}); err != nil {
result.Err = model.NewAppError("SqlUserStore.UpdateLastPictureUpdate", "store.sql_user.update_last_picture_update.app_error", nil, "user_id="+userId, http.StatusInternalServerError)
} else {
result.Data = userId
}
})
if _, err := us.GetMaster().Exec("UPDATE Users SET LastPictureUpdate = :Time, UpdateAt = :Time WHERE Id = :UserId", map[string]interface{}{"Time": curTime, "UserId": userId}); err != nil {
return model.NewAppError("SqlUserStore.UpdateLastPictureUpdate", "store.sql_user.update_last_picture_update.app_error", nil, "user_id="+userId, http.StatusInternalServerError)
}
return nil
}
func (us SqlUserStore) ResetLastPictureUpdate(userId string) *model.AppError {