Add configurable identity cache TTL (refresh stale names/avatars)#79
Closed
Frodotus wants to merge 1 commit into
Closed
Add configurable identity cache TTL (refresh stale names/avatars)#79Frodotus wants to merge 1 commit into
Frodotus wants to merge 1 commit into
Conversation
693a8bb to
4c95fde
Compare
a786b8a to
161aad0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #78.
What
Adds a configurable freshness window so resolved user/bot identities (name + avatar) are re-fetched once stale, instead of being cached forever.
How
CacheConfig.IdentityTTLDays(default 7);0keeps the historical "cache forever".UpsertUserstampsupdated_at(when the caller leaves it unset) so freshness is tracked.userResolvergains a TTL:Request/RequestBotskip only when cached and fresh; past the TTL they re-fetch (users.info/bots.info) and pick up renames + new avatars.avatar.Cache.Invalidate+image.Fetcher.Deletebust the never-cleared inflight gate, the cached render, and the fetcher's stableavatar-<id>entry, so a changed URL actually re-downloads.Testing
go test ./...passes. AddedTestUserResolverFresh(TTL decision incl.0=off and unstamped=stale) andTestUpsertUserStampsUpdatedAt(stamping + explicit value respected).