Fixing file info caching issue with Aurora for master (#5477)

Этот коммит содержится в:
Corey Hulen
2017-02-20 13:40:32 -05:00
коммит произвёл Christopher Speller
родитель dd4d8440ea
Коммит 274b9b6032
8 изменённых файлов: 39 добавлений и 17 удалений

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

@@ -421,13 +421,16 @@ func getFileInfosForPost(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
if infos, err := app.GetFileInfosForPost(postId); err != nil {
if infos, err := app.GetFileInfosForPost(postId, false); err != nil {
c.Err = err
return
} else if HandleEtag(model.GetEtagForFileInfos(infos), "Get File Infos For Post", w, r) {
return
} else {
w.Header().Set("Cache-Control", "max-age=2592000, public")
if len(infos) > 0 {
w.Header().Set("Cache-Control", "max-age=2592000, public")
}
w.Header().Set(model.HEADER_ETAG_SERVER, model.GetEtagForFileInfos(infos))
w.Write([]byte(model.FileInfosToJson(infos)))
}

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

@@ -136,7 +136,7 @@ func TestCreatePost(t *testing.T) {
} else if rpost9 := resp.Data.(*model.Post); len(rpost9.FileIds) != 3 {
t.Fatal("post should have 3 files")
} else {
infos := store.Must(app.Srv.Store.FileInfo().GetForPost(rpost9.Id, true)).([]*model.FileInfo)
infos := store.Must(app.Srv.Store.FileInfo().GetForPost(rpost9.Id, true, true)).([]*model.FileInfo)
if len(infos) != 3 {
t.Fatal("should've attached all 3 files to post")