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:
Matthew Meszaros
2026-05-25 15:25:06 +00:00
parent e8f741dc82
commit b4ece91383
+4 -19
View File
@@ -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)