Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,15 +495,15 @@ func saveEmailBodyCache(cache *EmailBodyCache) error {
}

// GetCachedEmailBody returns the cached body for a specific email, or nil if not cached.
// LastAccessedAt is updated by SaveEmailBody, not here -- a read should not
// mutate cache state.
func GetCachedEmailBody(folderName string, uid uint32, accountID string) *CachedEmailBody {
cache, err := LoadEmailBodyCache(folderName)
if err != nil {
return nil
}
for i, b := range cache.Bodies {
if b.UID == uid && b.AccountID == accountID {
cache.Bodies[i].LastAccessedAt = time.Now()
_ = saveEmailBodyCache(cache)
return &cache.Bodies[i]
}
}
Expand Down
Loading