mirror of
https://github.com/warmbly/warmbly.git
synced 2026-09-13 16:04:44 +00:00
perf: drop dead cipher.Encrypt calls from warmup task
the two cipher.Encrypt calls on subject and body in HandleEmailTask discarded their ciphertext and the plaintext was what got sent. warmup mail is not stored at rest, so the only effect was warming the user's DEK in cache via the preceding Cipher() call — also removed since nothing else in the warmup path needs it.
This commit is contained in:
@@ -159,31 +159,16 @@ func (s *tasksService) HandleEmailTask(task *proto.ProcessTask) *errx.Error {
|
||||
emailBody = GenerateConversationEmail(conversation, *account, false)
|
||||
}
|
||||
|
||||
// STEP 8: Encrypt content
|
||||
// STEP 8: Parse sender user ID for the outbound message.
|
||||
// Warmup mail is not stored at rest, so we no longer call the cipher
|
||||
// service here — the previous Encrypt() pair discarded its ciphertext
|
||||
// and only served to warm the user's DEK in cache.
|
||||
userUUID, err := uuid.Parse(account.UserID)
|
||||
if err != nil {
|
||||
sentry.CaptureException(err)
|
||||
return errx.InternalError()
|
||||
}
|
||||
|
||||
cipher, err := s.cipherService.Cipher(ctx, userUUID)
|
||||
if err != nil {
|
||||
sentry.CaptureException(err)
|
||||
return errx.InternalError()
|
||||
}
|
||||
|
||||
_, err = cipher.Encrypt(ctx, subject)
|
||||
if err != nil {
|
||||
sentry.CaptureException(err)
|
||||
return errx.InternalError()
|
||||
}
|
||||
|
||||
_, err = cipher.Encrypt(ctx, emailBody)
|
||||
if err != nil {
|
||||
sentry.CaptureException(err)
|
||||
return errx.InternalError()
|
||||
}
|
||||
|
||||
// STEP 9: Generate Message-ID
|
||||
messageID := generateMessageID(account.Email)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user