forked from Silverfish/proton-bridge
Skipped messages do not change total counts but shows as separate number
This commit is contained in:
@ -82,8 +82,6 @@ func (p *EMLProvider) getFilePathsPerFolder(rules transferRules) (map[string][]s
|
||||
}
|
||||
|
||||
func (p *EMLProvider) exportMessages(rule *Rule, filePaths []string, progress *Progress, ch chan<- Message) {
|
||||
count := uint(len(filePaths))
|
||||
|
||||
for _, filePath := range filePaths {
|
||||
if progress.shouldStop() {
|
||||
break
|
||||
@ -91,6 +89,8 @@ func (p *EMLProvider) exportMessages(rule *Rule, filePaths []string, progress *P
|
||||
|
||||
msg, err := p.exportMessage(rule, filePath)
|
||||
|
||||
progress.addMessage(filePath, msg.sourceNames(), msg.targetNames())
|
||||
|
||||
// Read and check time in body only if the rule specifies it
|
||||
// to not waste energy.
|
||||
if err == nil && rule.HasTimeLimit() {
|
||||
@ -99,17 +99,11 @@ func (p *EMLProvider) exportMessages(rule *Rule, filePaths []string, progress *P
|
||||
err = msgTimeErr
|
||||
} else if !rule.isTimeInRange(msgTime) {
|
||||
log.WithField("msg", filePath).Debug("Message skipped due to time")
|
||||
|
||||
count--
|
||||
progress.updateCount(rule.SourceMailbox.Name, count)
|
||||
progress.messageSkipped(filePath)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// addMessage is called after time check to not report message
|
||||
// which should not be exported but any error from reading body
|
||||
// or parsing time is reported as an error.
|
||||
progress.addMessage(filePath, msg.sourceNames(), msg.targetNames())
|
||||
progress.messageExported(filePath, msg.Body, err)
|
||||
if err == nil {
|
||||
ch <- msg
|
||||
|
||||
Reference in New Issue
Block a user