mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 01:54:40 +08:00
[local-sync] Add todos
This commit is contained in:
parent
a185a8a5fe
commit
878735f52e
2 changed files with 13 additions and 0 deletions
|
@ -259,6 +259,9 @@ class FetchMessagesInFolder {
|
|||
uid: existingMessage.folderImapUID,
|
||||
}, `FetchMessagesInFolder: Updated message`)
|
||||
} else {
|
||||
// TODO investigate batching processing new messages
|
||||
// We could measure load of actual sync vs load of just message processing
|
||||
// to determine how meaningful it is
|
||||
processNewMessage(messageValues, imapMessage)
|
||||
this._logger.info({
|
||||
message: messageValues,
|
||||
|
@ -323,6 +326,7 @@ class FetchMessagesInFolder {
|
|||
} else {
|
||||
this._logger.info('FetchMessagesInFolder: fetchedmax == uidnext, nothing more recent to fetch.')
|
||||
}
|
||||
|
||||
if (savedSyncState.fetchedmin > 1) {
|
||||
const lowerbound = Math.max(1, savedSyncState.fetchedmin - FETCH_MESSAGES_COUNT);
|
||||
desiredRanges.push({min: lowerbound, max: savedSyncState.fetchedmin})
|
||||
|
|
|
@ -30,6 +30,7 @@ class SyncWorker {
|
|||
// the database, because otherwise things get /crazy/ messy and I don't like
|
||||
// having counters and garbage everywhere.
|
||||
if (!account.firstSyncCompletion) {
|
||||
// TODO extract this into its own module, can use later on for exchange
|
||||
this._logger.info("This is initial sync. Setting up metrics collection!");
|
||||
|
||||
let seen = 0;
|
||||
|
@ -188,6 +189,13 @@ class SyncWorker {
|
|||
}
|
||||
|
||||
async syncMessagesInAllFolders() {
|
||||
// TODO prioritize syncing all of inbox first if there's a ton of folders (e.g. imap
|
||||
// accounts). If there are many folders, we would only sync the first n
|
||||
// messages in the inbox and not go back to it until we've done the same for
|
||||
// the rest of the folders, which would give the appearance of the inbox
|
||||
// syncing slowly. This should only be done during initial sync.
|
||||
// TODO Also consider using multiple imap connections, 1 for inbox, one for the
|
||||
// rest
|
||||
const {Folder} = this._db;
|
||||
const {folderSyncOptions} = this._account.syncPolicy;
|
||||
|
||||
|
@ -196,6 +204,7 @@ class SyncWorker {
|
|||
const foldersSorted = folders.sort((a, b) =>
|
||||
(priority.indexOf(a.role) - priority.indexOf(b.role)) * -1
|
||||
)
|
||||
// TODO make sure this order is correct
|
||||
|
||||
return await Promise.all(foldersSorted.map((cat) =>
|
||||
this._conn.runOperation(new FetchMessagesInFolder(cat, folderSyncOptions, this._logger))
|
||||
|
|
Loading…
Reference in a new issue