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

Avatars uploaded to instance are not cached #3323

Closed
thehowl opened this issue Jan 7, 2018 · 2 comments · Fixed by #3376
Closed

Avatars uploaded to instance are not cached #3323

thehowl opened this issue Jan 7, 2018 · 2 comments · Fixed by #3376
Labels
type/enhancement An improvement of existing functionality
Milestone

Comments

@thehowl
Copy link
Contributor

thehowl commented Jan 7, 2018

Example when loading my try.gitea.io dashboard:

image

This leads to some pretty poor performance when loading the page. On multiple retries, avatars served from try.gitea.io directly are never cached - which is pretty bad. This seems to be an issue with macaron's static file server itself, since as far as I can tell it never e.g. checks for the ETag on the request - only sends it. There is also no Expires header, which would be pretty nice to set for at least some time (e.g. an hour).

The best way to go here to me seems to copy the static file serving function and suit it to Gitea's needs altogether - seeing as I doubt unknwon will merge PRs to macaron (due to his current inactivity)

@lunny lunny added the type/enhancement An improvement of existing functionality label Jan 9, 2018
@ethantkoenig
Copy link
Member

FWIW, I have succeeded in making contribution to unknwon's repos in the past (go-macaron/macaron#149, go-ini/ini#115). Even if in the short-term we have to make the change to gitea, I do think we should ultimately try to add caching to macaron (which is where it really belongs)

@thehowl
Copy link
Contributor Author

thehowl commented Jan 20, 2018

Fair enough. I've created an issue for it on the macaron repository: go-macaron/macaron#152 should the owner come back, I'll be very glad to port over the feature there.

lafriks pushed a commit that referenced this issue Feb 3, 2018
* Enable caching on assets and avatars

Fixes #3323

* Only set avatar in user BeforeUpdate when there is no avatar set

* add error checking after stat

* gofmt

* Change cache time for avatars to an hour
@lunny lunny added this to the 1.5.0 milestone Feb 4, 2018
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants