Rename Invalite -> InvalidateLazyLoadedUser

This commit is contained in:
Till Faelligen 2022-08-05 13:45:46 +02:00
parent 93442c6558
commit b889ae9bb0
No known key found for this signature in database
GPG key ID: 3DF82D8AB9211D4E
2 changed files with 4 additions and 4 deletions

View file

@ -14,7 +14,7 @@ type lazyLoadingCacheKey struct {
type LazyLoadCache interface { type LazyLoadCache interface {
StoreLazyLoadedUser(device *userapi.Device, roomID, userID, eventID string) StoreLazyLoadedUser(device *userapi.Device, roomID, userID, eventID string)
IsLazyLoadedUserCached(device *userapi.Device, roomID, userID string) (string, bool) IsLazyLoadedUserCached(device *userapi.Device, roomID, userID string) (string, bool)
Invalidate(device *userapi.Device, roomID, userID string) InvalidateLazyLoadedUser(device *userapi.Device, roomID, userID string)
} }
func (c Caches) StoreLazyLoadedUser(device *userapi.Device, roomID, userID, eventID string) { func (c Caches) StoreLazyLoadedUser(device *userapi.Device, roomID, userID, eventID string) {
@ -35,7 +35,7 @@ func (c Caches) IsLazyLoadedUserCached(device *userapi.Device, roomID, userID st
}) })
} }
func (c Caches) Invalidate(device *userapi.Device, roomID, userID string) { func (c Caches) InvalidateLazyLoadedUser(device *userapi.Device, roomID, userID string) {
c.LazyLoading.Unset(lazyLoadingCacheKey{ c.LazyLoading.Unset(lazyLoadingCacheKey{
UserID: device.UserID, UserID: device.UserID,
DeviceID: device.ID, DeviceID: device.ID,

View file

@ -104,12 +104,12 @@ func (p *PDUStreamProvider) CompleteSync(
req.Log.WithError(err).Error("unable to update event filter with ignored users") req.Log.WithError(err).Error("unable to update event filter with ignored users")
} }
// Invalidate the lazyLoadCache, otherwise we end up with missing displaynames/avatars // InvalidateLazyLoadedUser the lazyLoadCache, otherwise we end up with missing displaynames/avatars
// TODO: This might be inefficient, when joined to many and/or large rooms. // TODO: This might be inefficient, when joined to many and/or large rooms.
for _, roomID := range joinedRoomIDs { for _, roomID := range joinedRoomIDs {
joinedUsers := p.notifier.JoinedUsers(roomID) joinedUsers := p.notifier.JoinedUsers(roomID)
for _, sharedUser := range joinedUsers { for _, sharedUser := range joinedUsers {
p.lazyLoadCache.Invalidate(req.Device, roomID, sharedUser) p.lazyLoadCache.InvalidateLazyLoadedUser(req.Device, roomID, sharedUser)
} }
} }