Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add template cache #3755

Merged
merged 14 commits into from
Jun 1, 2020
Merged

Conversation

Chocobozzz
Copy link
Contributor

@Chocobozzz Chocobozzz commented Mar 24, 2020

It's a bit of a shame to use sync functions when we render template: https://github.com/ether/etherpad-lite/blob/develop/src/node/eejs/index.js#L106

I don't think we can change this function to be async, so I added a readFile cache and an EJS compilation cache. This is just a proposal because I'm not sure we expect that templates never change after an etherpad startup.

See also #642

muxator and others added 14 commits April 10, 2018 00:17
due to createRelease.sh not catching an error from sed and continuing:
   sed: -e expression ether#1, char 66: unterminated `s' command
From now on, releases will be cut from develop, and merged directly into master.

Each release will be a tag on the master branch (e.g. 1.7.0).
A "release/1.7.0" branch will eventually be created only if/when a hotfix will
be needed.
UPGRADE NOTES: if you have custom files in src/static/custom, save them
somewhere else, revert the directory contents, update to Etherpad 1.7.5, and
finally put them back in their new location, uder src/static/skins/no-skin.
The previous revision on master (d967914), that claimed to be 1.8.0, had a
problem (see ether#3654), and so 1.8.0 was put on hold.

In ether#3660 I decided to do a beta.1 release, in order to be able to catch similar
problems.

Closes ether#3658.
…d and file were reminified uselessly.

By specification [0], the if-modified-since HTTP header sent by browsers does
not include milliseconds.

Before this patch, let's say a file was generate at time:
    t_real-file         = 2020-03-22T02:15:53.548Z (note the fractional seconds)

When issuing a conditional request, the browser would truncate the fractional
part, and only request an if-modified-since with this contents:
    t_if-modified-since = 2020-03-22T02:15:53.000Z

The minify() function would return HTTP/304 only if
t_if-modified-since >= t_real-file, but this would never be true unless, by
chance, a file was generated at XX.000Z.

This resulted in that file being minified/compressed again and resent to the
client for no reason. After this patch, the server correctly responds with
HTTP/304 without doing any computation, and the browser uses the cached file.

[0] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since
@JohnMcLear
Copy link
Member

Can you confirm this renders the read only pads with the expected content? IE it shouldn't show the stars for saved revision.

@Chocobozzz
Copy link
Contributor Author

Chocobozzz commented Mar 25, 2020

Yes it works correctly (with /p/r.... path)
screen_2020-03-25-10:40:18

@JohnMcLear
Copy link
Member

Good for review/merge. @muxator

@JohnMcLear JohnMcLear requested a review from muxator March 28, 2020 14:32
@Chocobozzz Chocobozzz changed the base branch from master to develop April 1, 2020 14:12
@Chocobozzz Chocobozzz force-pushed the feature/template-cache branch from b668097 to e977102 Compare April 1, 2020 14:15
@muxator muxator force-pushed the feature/template-cache branch from e977102 to b668097 Compare April 4, 2020 16:31
@muxator muxator added this to the 1.8.4 milestone Apr 19, 2020
@muxator
Copy link
Contributor

muxator commented Apr 19, 2020

We'll integrate this in 1.8.4

@JohnMcLear JohnMcLear self-requested a review June 1, 2020 13:52
@JohnMcLear JohnMcLear merged commit 59b1a2d into ether:develop Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants