A social RSS reader built on the AT Protocol. glean.at
glean atproto atmosphere rss feed social app
14
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add in-memory profile caching with TTL

+18
+18
internal/atproto/auth.go
··· 6 6 "net" 7 7 "net/http" 8 8 "os" 9 + "sync" 9 10 "time" 10 11 11 12 "github.com/bluesky-social/indigo/atproto/identity" ··· 118 119 AvatarURL string 119 120 } 120 121 122 + type profileEntry struct { 123 + profile Profile 124 + fetched time.Time 125 + } 126 + 127 + var profileCache sync.Map 128 + 129 + const profileCacheTTL = 4 * time.Hour 130 + 121 131 func ResolveProfile(ctx context.Context, did string) Profile { 132 + if cached, ok := profileCache.Load(did); ok { 133 + entry := cached.(*profileEntry) 134 + if time.Since(entry.fetched) < profileCacheTTL { 135 + return entry.profile 136 + } 137 + } 138 + 122 139 ident, err := ResolveIdentity(ctx, did) 123 140 if err != nil { 124 141 return Profile{} ··· 140 157 p.DisplayName = dn 141 158 p.AvatarURL = avatar 142 159 160 + profileCache.Store(did, &profileEntry{profile: p, fetched: time.Now()}) 143 161 return p 144 162 }