arXiv / arxiv-submission-ui

User interface of NG submit system.
MIT License
2 stars 6 forks source link

ARXIVNG-2218: Compiled PDF and autotex.log cached by UI. #142

Closed DavidLFielding closed 5 years ago

DavidLFielding commented 5 years ago

The problem is that Chrome(pdf helper) caches the PDF and autotex log such that changing the source and recompiling ends up with a stale PDF/log getting displayed.

I've tried to get this working using ETags. ETags are clearly visible using inspector yet Chrome uses a stale copy of PDF/log.

One site states: Referring to 'no-store' / 'no-cache' directive: "These headers express a very conservative cache plan. Basically: Don’t cache. Despite this, Chrome and other browsers may still store the response."

The recommendation was to set max-age to 0. While I'm not happy with this solution I was not able to get ETags to work. Setting send_file() parameter 'cache_timeout' to 0 sets the cache max_age correctly and results in the expected behavior of not caching/displaying previously compiled sources.

I did express the difficulties I was experiencing with ETag on Slack and did not receive any responses.

Another option, which would only reload PDF/log when they change, would be to add the checksum to the compilation_log or preview URL such that the browser's built-in caching would recognize a change to the URL and reload the page only when the checksum changes.

I did leave in the code to set ETag in case anyone would like to experiment. Maybe a second set of eyes may see something I missed.

In any event, the current solution of setting cache max-age 0 works. I don't believe the bandwidth from reloading PDFs/logs is significant. If someone wants to assist with ETag solution that would be great too.

erickpeirson commented 5 years ago

Fixes #110

erickpeirson commented 5 years ago

Fixes #103