GODT-1523: Reduce unnecessary shell executions. Inspired by @kortschak.

This commit is contained in:
Jakub
2022-08-16 15:53:29 +02:00
parent 1ed7b690a5
commit 8ebdb466f7
15 changed files with 240 additions and 117 deletions

View File

@ -313,16 +313,16 @@ func (su *smtpUser) Send(returnPath string, to []string, messageReader io.Reader
startTime := time.Now()
for isSending && time.Since(startTime) < 90*time.Second {
log.Debug("Message is still in send queue, waiting for a bit")
log.Warn("Message is still in send queue, waiting for a bit")
time.Sleep(15 * time.Second)
isSending, wasSent = su.backend.sendRecorder.isSendingOrSent(su.client(), sendRecorderMessageHash)
}
if isSending {
log.Debug("Message is still in send queue, returning error to prevent client from adding it to the sent folder prematurely")
log.Warn("Message is still in send queue, returning error to prevent client from adding it to the sent folder prematurely")
return errors.New("original message is still being sent")
}
if wasSent {
log.Debug("Message was already sent")
log.Warn("Message was already sent")
return nil
}