lib/imap/backup/serializer/appender.rb in imap-backup-7.0.0.rc1 vs lib/imap/backup/serializer/appender.rb in imap-backup-7.0.2

- old
+ new

@@ -12,11 +12,12 @@ def run(uid:, message:, flags:) raise "Can't add messages without uid_validity" if !imap.uid_validity uid = uid.to_i - if imap.include?(uid) + existing = imap.get(uid) + if existing Logger.logger.debug( "[#{folder}] message #{uid} already downloaded - skipping" ) return end @@ -36,15 +37,15 @@ mbox_appended = true imap.append uid, serialized.length, flags rescue StandardError => e mbox.rewind(initial) if mbox_appended - message = <<-ERROR.gsub(/^\s*/m, "") + error = <<-ERROR.gsub(/^\s*/m, "") [#{folder}] failed to append message #{uid}: #{message}. #{e}: #{e.backtrace.join("\n")}" ERROR - Logger.logger.warn message + Logger.logger.warn error end end end end