This seems wrong.  The additional guard here means that we will never sync the folder list for accounts for which we're doing periodic sync.  I assume the problem was that some type of race occurs between the syncFolderList job and the periodic sync so that the sync is still happening while we're shutting down the process. (syncFolderList for IMAP requests an account save when it's done, so if it got that far, the runAfterSaves logic should make things happy.)

I'm currently thinking the right course of action here is to modify CronSyncer.syncAccount so that after the sync is invoked and before we call runAfterSaves, we also wrap a MailUniverse.waitForAccountOps() call in there.  So in the event of a race between the folder list sync and the Inbox sync, we would wait for the folder list sync to complete and its account save operation too.  The rationale is that deferred offline ops in real-world operation could end up in here too, and we don't want to keep trying to perform them over and over.

We will need to make a minor improvement to waitForAccountOps in its initial check.  Specifically, it checks the server queue length without checking for MailUniverse.online or account.enabled.  Just like at the bottom of MailUniverse._serverOpCompleted, it needs to check those and only consider the server queue length if we're online and the account is enabled.

Does that sound reasonable?  I realize there are probably wake-lock issues that we'll need to address somewhat separately for our general job/operation stuff.  That might be an Oslo thing.