Caching #480

병합됨
Plume_migration_agent 님이 cache 에서 master 로 3 커밋을 2019-03-16 14:33:28 +00:00 병합함
소유자

Try to cache static resources.
Static non media file's timestamps are hashed at compile tome so that modifying them invalidate old cache.
For some reason, plume-front.wasm isn't loaded from cache, even if it contains the right headers.
I changed nothing and now it is? I guess I'm ok with it
I'll look into adding Etag support too
All response made from templates and not containing a form are now Etag-cached

Try to cache static resources. Static non media file's timestamps are hashed at compile tome so that modifying them invalidate old cache. ~~For some reason, plume-front.wasm isn't loaded from cache, even if it contains the right headers.~~ I changed nothing and now it is? I guess I'm ok with it ~~I'll look into adding Etag support too~~ All response made from templates and not containing a form are now Etag-cached
igalic (Migrated from github.com) 검토됨 2019-03-15 21:37:29 +00:00
igalic (Migrated from github.com) left a comment

👀

👀
@ -5,0 +13,4 @@
.spawn()
.expect("failed find command");
let sort = Command::new("sort")
igalic (Migrated from github.com) 코멘트함, 2019-03-15 21:28:40 +00:00

i'd rather this wasn't random, but deterministic

such as the file's she256sum

i'd rather this wasn't random, but deterministic such as the file's she256sum
trinity-1686a 검토됨 2019-03-15 22:46:35 +00:00
@ -5,0 +13,4 @@
.spawn()
.expect("failed find command");
let sort = Command::new("sort")
작성자
소유자

What is your issue with it being random? It's fixed at compile time, so assuming a production server, which may restart but won't recompile often, the cache will be ok. My first through was using git commit sha, but this may be unnecessary information disclosure

What is your issue with it being random? It's fixed at compile time, so assuming a production server, which may restart but won't recompile often, the cache will be ok. My first through was using git commit sha, but this may be unnecessary information disclosure
igalic (Migrated from github.com) 검토됨 2019-03-16 05:39:10 +00:00
@ -5,0 +13,4 @@
.spawn()
.expect("failed find command");
let sort = Command::new("sort")
igalic (Migrated from github.com) 코멘트함, 2019-03-16 05:39:09 +00:00

if nothing about the code changes, the cache_id shouldn't change either

if nothing about the code changes, the cache_id shouldn't change either
codecov[bot] 코멘트함, 2019-03-16 08:45:11 +00:00 (Migrated from github.com)

Codecov Report

Merging #480 into master will decrease coverage by 0.31%.
The diff coverage is 0%.

@@            Coverage Diff             @@
##           master     #480      +/-   ##
==========================================
- Coverage   27.13%   26.82%   -0.32%     
==========================================
  Files          64       64              
  Lines        7337     7423      +86     
==========================================
  Hits         1991     1991              
- Misses       5346     5432      +86
# [Codecov](https://codecov.io/gh/Plume-org/Plume/pull/480?src=pr&el=h1) Report > Merging [#480](https://codecov.io/gh/Plume-org/Plume/pull/480?src=pr&el=desc) into [master](https://codecov.io/gh/Plume-org/Plume/commit/90baf9beb1884a886d4f2bf9df96f761c582d765?src=pr&el=desc) will **decrease** coverage by `0.31%`. > The diff coverage is `0%`. ```diff @@ Coverage Diff @@ ## master #480 +/- ## ========================================== - Coverage 27.13% 26.82% -0.32% ========================================== Files 64 64 Lines 7337 7423 +86 ========================================== Hits 1991 1991 - Misses 5346 5432 +86 ```
elegaanz (Migrated from github.com) 검토됨 2019-03-16 08:48:43 +00:00
@ -5,0 +13,4 @@
.spawn()
.expect("failed find command");
let sort = Command::new("sort")
elegaanz (Migrated from github.com) 코멘트함, 2019-03-16 08:48:43 +00:00

The build won't be run again if the code didn't changed, so the ID will not change.

The build won't be run again if the code didn't changed, so the ID will not change.
elegaanz (Migrated from github.com) 검토됨 2019-03-16 10:08:34 +00:00
elegaanz (Migrated from github.com) 코멘트함, 2019-03-16 10:08:34 +00:00

You should probably remove it from Cargo.toml too.

You should probably remove it from `Cargo.toml` too.
trinity-1686a 검토됨 2019-03-16 10:09:19 +00:00
작성자
소유자

I totally forgot about that

I totally forgot about that
igalic (Migrated from github.com) 검토됨 2019-03-16 10:19:00 +00:00
@ -5,0 +13,4 @@
.spawn()
.expect("failed find command");
let sort = Command::new("sort")
igalic (Migrated from github.com) 코멘트함, 2019-03-16 10:18:59 +00:00

yes, in our development environment that is true, but not for anyone building packages or container images of our software. they always start from a clean slate

yes, in our development environment that is true, but not for anyone building packages or container images of our software. they always start from a clean slate
igalic (Migrated from github.com) 검토됨 2019-03-16 11:24:59 +00:00
igalic (Migrated from github.com) left a comment

👍

👍
@ -5,0 +13,4 @@
.spawn()
.expect("failed find command");
let sort = Command::new("sort")
igalic (Migrated from github.com) 코멘트함, 2019-03-16 11:24:09 +00:00

btw, is there no way to do this in rust?

btw, is there no way to do this in rust?
trinity-1686a 검토됨 2019-03-16 12:08:29 +00:00
@ -5,0 +13,4 @@
.spawn()
.expect("failed find command");
let sort = Command::new("sort")
작성자
소유자

I think there are plenty, but I'm lazy and it's a build script. I prototyped using bash, so my rust code is basically bash translated (if you find it really bad, I can change that but I don't know if it's really useful)

I think there are plenty, but I'm lazy and it's a build script. I prototyped using bash, so my rust code is basically bash translated (if you find it really bad, I can change that but I don't know if it's really useful)
igalic (Migrated from github.com) 검토됨 2019-03-16 12:13:25 +00:00
@ -5,0 +13,4 @@
.spawn()
.expect("failed find command");
let sort = Command::new("sort")
igalic (Migrated from github.com) 코멘트함, 2019-03-16 12:13:25 +00:00

nah, i was just curious

nah, i was just curious
elegaanz (Migrated from github.com) 검토됨 2019-03-16 12:30:53 +00:00
@ -11,0 +37,4 @@
.merge(HtmlCt(self.0).respond_to(r)?)
.header(ETag(EntityTag::strong(etag)))
.ok()
}
elegaanz (Migrated from github.com) 코멘트함, 2019-03-16 12:30:52 +00:00

Probably obvious, but why do we disable caching on pages with a form?

Probably obvious, but why do we disable caching on pages with a form?
trinity-1686a 검토됨 2019-03-16 12:37:12 +00:00
@ -11,0 +37,4 @@
.merge(HtmlCt(self.0).respond_to(r)?)
.header(ETag(EntityTag::strong(etag)))
.ok()
}
작성자
소유자

If the page contain a form, the csrf token will be cached, and may no longer match user's cookies. As these tokens are added later by a fairing, there is no way to detect the page changed here. The other solution could be to allow caching of page and for rocket_csrf to remove ETag when appropriate

If the page contain a form, the csrf token will be cached, and may no longer match user's cookies. As these tokens are added later by a fairing, there is no way to detect the page changed here. The other solution could be to allow caching of page and for rocket_csrf to remove ETag when appropriate
elegaanz (Migrated from github.com) 이 변경사항을 승인함 2019-03-16 14:09:12 +00:00
elegaanz (Migrated from github.com) left a comment

👍 Thanks!

:+1: Thanks!
로그인하여 이 대화에 참여하세요.
No reviewers
마일스톤 없음
프로젝트 없음
담당자 없음
참가자 2명
알림
마감일
기한이 올바르지 않거나 범위를 벗어났습니다. "yyyy-mm-dd"형식을 사용해주십시오.

마감일이 설정되지 않았습니다.

전제조건

전제조건이 설정되지 않았습니다.

Reference: Plume/Plume#480
No description provided.