Skip to content

perf(core): allow versioned avatar URLs to be cached for 30 days - #64295

Draft
pringelmann wants to merge 1 commit into
masterfrom
perf/61726/avatar-url-versioning
Draft

perf(core): allow versioned avatar URLs to be cached for 30 days#64295
pringelmann wants to merge 1 commit into
masterfrom
perf/61726/avatar-url-versioning

Conversation

@pringelmann

Copy link
Copy Markdown
Contributor

Summary

Avatar URLs can now carry a ?v= version. With it, the response is cached for 30 days instead of 1.

The 1 day TTL means avatars get revalidated constantly, and a 304 here costs nearly as much as a 200 because the time goes into PHP bootstrap, not on sending the image itself. A big Talk call is a few hundred of those.

The version is bumped on avatar upload/removal, avatar scope changes, and enable/disable. Avatars that depend on who's asking (v2-private) keep the 1 day window, since one URL serves different bytes to different viewers.

?v= only widens the cache window, it never picks the image. A stale version still returns the current avatar.

Nothing sends it yet, so this is a no-op alone. Talk and @nextcloud/vue follow separately.

Trade-off

A bump only changes future URLs, it can't reach a cache that's already populated. So a deleted account's avatar can now linger in a browser for a month instead of a day. Same for one switched to v2-private. 7 days also works if there are privacy concerns.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
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.

Improve avatar management to reduce load during large Talk calls

1 participant