mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-20 09:06:45 +00:00
GODT-1433: Do not save message to cache if it's a draft.
- remove: deprecated SetContentTypeAndHeader - fix: write metada unit test - change: do not cache body for Drafts - change: do not cache body structure (header) for Drafts - change: do not cache body size for Drafts
This commit is contained in:
@ -122,9 +122,10 @@ func (store *Store) getCachedMessage(messageID string) ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// NOTE(GODT-1158): No need to block until cache has been set; do this async?
|
||||
if err := store.cache.Set(store.user.ID(), messageID, literal); err != nil {
|
||||
logrus.WithError(err).Error("Failed to cache message")
|
||||
if !store.isMessageADraft(messageID) {
|
||||
if err := store.cache.Set(store.user.ID(), messageID, literal); err != nil {
|
||||
logrus.WithError(err).Error("Failed to cache message")
|
||||
}
|
||||
}
|
||||
|
||||
return literal, nil
|
||||
@ -141,6 +142,10 @@ func (store *Store) BuildAndCacheMessage(ctx context.Context, messageID string)
|
||||
buildAndCacheJobs <- struct{}{}
|
||||
defer func() { <-buildAndCacheJobs }()
|
||||
|
||||
if store.isMessageADraft(messageID) {
|
||||
return nil
|
||||
}
|
||||
|
||||
job, done := store.newBuildJob(ctx, messageID, message.BackgroundPriority)
|
||||
defer done()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user