Skip to content

workbench.api.js takes very long time to load in 3.1.1 and not cached properly on FireFox #1536

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

Closed
marty1885 opened this issue Apr 16, 2020 · 8 comments
Labels
bug Something isn't working

Comments

@marty1885
Copy link

marty1885 commented Apr 16, 2020

Hi,

I've just updated code-server to 3.1.1. And I run my code-server on a remote server. I find the new code-sever taking fairly long (about 1.3 minute in my case). It seems to be caused by the long loading time of workbench.api.js. Furthermore on FireFox, this file although cached by FireFox; FireFox won't use the cache on the next load. Rendering opening code-server a waiting game.

Also, as a side note. My PC can connect to the server at ~30Mbits/s but workbench.api.js loads ~880Kbits/s. Which is quite slow.

(loading time of workbench.api.js on Chrome)
image

(FireFox loads the file every time)
image
image

Best

OS: Arch Linux AArch64
VSCode: 3.1.1
Installed via PKGBUILD

@code-asher
Copy link
Member

Maybe we should gzip any file that's over a certain size or just explicitly gzip the workbench file.

You wouldn't happen to have "disable cache" checked in the Firefox dev tools, do you? (It's along the top near the Filter URLs text box.)

@marty1885
Copy link
Author

No, I don't have cache disabled. (Otherwise I don't think it'd show up in FF's cached file list)

@code-asher
Copy link
Member

code-asher commented Apr 16, 2020

I'm not sure; the checkbox might just prevent Firefox from using the cache rather than preventing it from storing into the cache. Could you verify whether the request has a Cache-Control header set? That's what we use to cache files so maybe it's not being sent somehow.

@marty1885
Copy link
Author

My bad. FireFox sends Cache-Control: max-age=0 when reloading. Forcing to reload everything.. Is there a way around that? Maybe send 304 Content Not Changed?

@nhooyr
Copy link
Contributor

nhooyr commented Apr 17, 2020

That's interesting, why would Firefox do that?

@marty1885
Copy link
Author

I believe it's the default behaviour from the older ages of the web when the only reason to reload a page is because something is broken so the cache can't be trusted. And this behaviour seems to be the compliant one with RFCs.

Reference:
https://stackoverflow.com/questions/60902008/why-does-firefox-ignore-cache-headers-and-revalidate-on-refresh

@code-asher
Copy link
Member

code-asher commented Apr 17, 2020

Ahh, that's very interesting. I tested it out and going to the website again (typing it out, hitting a bookmark or a link, or hitting enter again in the URL bar) uses the cache but actually refreshing (using the button, F5, ctrl+r, etc) will not use the cache.

@nhooyr nhooyr added bug Something isn't working and removed needs-investigation labels Dec 7, 2020
@code-asher
Copy link
Member

Fixed by #2680.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants