go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.59k stars 5.45k forks source link

Avatars uploaded to instance are not cached #3323

Closed thehowl closed 6 years ago

thehowl commented 6 years ago

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)

ethantkoenig commented 6 years ago

FWIW, I have succeeded in making contribution to unknwon's repos in the past (https://github.com/go-macaron/macaron/pull/149, https://github.com/go-ini/ini/pull/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 commented 6 years ago

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