You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Safe type assertion to handle cases where cached data might be corrupted or in legacy format
102
+
cachedAvatar, ok:=result.(CachedAvatar)
103
+
if!ok {
104
+
// Log the type mismatch with the actual stored value for debugging
105
+
log.Errorf("Invalid cached avatar type for user %d, size %d. Expected CachedAvatar, got %T with value: %+v. Clearing cache and regenerating.", u.ID, size, result, result)
106
+
107
+
// Clear the invalid cache entry
108
+
iferr:=keyvalue.Del(cacheKey); err!=nil {
109
+
log.Errorf("Failed to clear invalid cache entry for key %s: %v", cacheKey, err)
110
+
}
111
+
112
+
// Regenerate the avatar by calling the function again (without the corrupted cache)
0 commit comments