Skip to content

Commit

Permalink
Handle errors with any single emlx file without cratering the whole i…
Browse files Browse the repository at this point in the history
…mport.

Reduced the console updates to 1/250msgs.
  • Loading branch information
ahknight committed May 2, 2016
1 parent 7c22d15 commit 0e95434
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions emlx/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,15 @@ def main(argc, argv):
box_maildir = maildir
logging.info("writing messages to %s" % box_maildir.name)

for msg in progress.bar(box.messages(), expected_size=len(box.messages()), label="Importing %s: " % box.name):
for msg in progress.bar(box.messages(), expected_size=len(box.messages()), label="Importing %s: " % box.name, every=250):
if STOP:
break
if args.dry_run == False:
m = msg.get_message()
box_maildir.add_message(m.get_maildir_message())
try:
m = msg.get_message()
box_maildir.add_message(m.get_maildir_message())
except:
logging.error("%s: invalid emlx file (msg %s)" % (path, msg.msgid))
else:
if msg.partial:
m = msg.get_message()
Expand Down

0 comments on commit 0e95434

Please sign in to comment.