Closed svetzal closed 2 years ago
Hi @svetzal
Thanks for opening the issue.
I think this could be handled in a similar way to download errors:
retry_on_error(errors: [Net::IMAP::BadResponseError])
in the append
function in folder.rb
, returning nil
if the call fails a couple of times,upload_message
function in upload.rb
.I think the TOOBIG message is probably an example where a retry would not be appropriate, if I get no other errors I'll see if I can nicely express a way to do retries around anything else. I'm awaiting a restore of about 45,000 messages right now.
Thanks for the direction. I have a dirty hack in right now in my fork, just to see what kinds of errors I might see, but I'll work on some kind of PR after the weekend.
In imap-backup, exceptions are only distinguished by their class. Basing behaviour on the message attribute containing "TOOBIG" would be out of keeping with the rest of the application.
I would handle it this way:
A single generic retry for Net::IMAP::BadResponseError
handles other types of failures caused by transitory problems, but also handles "TOOBIG", which of course is not transitory.
A Logger.logger.debug
of the error message will allow the user to understand the exact cause of failure, while in upload.rb
we can report any skipped message UIDs with Logger.logger.warn
.
This will mean that, without debug logging enabled, the skipped message will show up, and will allow fuller info if the user wants to dig into the problem with debug logging.
Hmm, it's been a few years since I was doing ruby full-time :) but I have something I'm reasonably happy with - just seeing how it works in practice.
I realize this is a lot like coding by remote control, but given the above guidance, what kind of testing would you like to see on this? I'm snooping around but coming up dry on sad-path checks like what I'm thinking.
Thanks for indulging me, I'm enjoying my foray back into ruby, I miss it.
Everything was working great for me until this - I have a bunch of mailboxes to move off Google and onto iCloud this weekend.
The message is persistent, it simply gets to this message in the backup data and bails every time, which blocks the rest of the restore.
I'm looking at
uploader.rb
line 24, and might just set it inside a rescue block and find a way to collect UIDs that didn't upload to report to the user at the end.Just wondering if you've already got thoughts on how you might address this.