mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 16:26:08 +08:00
[client-sync] Don't throttle while syncing first 500 threads
Summary: We want to get to a usable inbox as quickly as possible, and throttling prevents this. We should basically only be throttling for historical mail syncing. Test Plan: Run initial sync benchmark, it's 117% faster on battery Reviewers: evan, juan, spang Reviewed By: juan, spang Differential Revision: https://phab.nylas.com/D4266
This commit is contained in:
parent
60e6113f87
commit
0508180712
|
@ -471,7 +471,11 @@ class FetchMessagesInFolderIMAP extends SyncTask {
|
||||||
if (savedSyncState.fetchedmin > savedSyncState.minUID) {
|
if (savedSyncState.fetchedmin > savedSyncState.minUID) {
|
||||||
const lowerbound = Math.max(savedSyncState.minUID, savedSyncState.fetchedmin - batchSize);
|
const lowerbound = Math.max(savedSyncState.minUID, savedSyncState.fetchedmin - batchSize);
|
||||||
// this._logger.log(`FetchMessagesInFolderIMAP: fetching ${lowerbound}:${savedSyncState.fetchedmin}`);
|
// this._logger.log(`FetchMessagesInFolderIMAP: fetching ${lowerbound}:${savedSyncState.fetchedmin}`);
|
||||||
totalProcessedMessages += yield this._fetchAndProcessMessages({min: lowerbound, max: savedSyncState.fetchedmin});
|
totalProcessedMessages += yield this._fetchAndProcessMessages({
|
||||||
|
min: lowerbound,
|
||||||
|
max: savedSyncState.fetchedmin,
|
||||||
|
throttle: this._syncWorker.throttlingEnabled(),
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// this._logger.log("FetchMessagesInFolderIMAP: fetchedmin == minUID, nothing older to fetch.")
|
// this._logger.log("FetchMessagesInFolderIMAP: fetchedmin == minUID, nothing older to fetch.")
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ class SyncWorker {
|
||||||
this._lastSyncTime = null
|
this._lastSyncTime = null
|
||||||
this._interrupted = false
|
this._interrupted = false
|
||||||
this._syncInProgress = false
|
this._syncInProgress = false
|
||||||
|
this._throttlingEnabled = false
|
||||||
this._stopped = false
|
this._stopped = false
|
||||||
this._destroyed = false
|
this._destroyed = false
|
||||||
this._shouldIgnoreInboxFlagUpdates = false
|
this._shouldIgnoreInboxFlagUpdates = false
|
||||||
|
@ -82,6 +83,7 @@ class SyncWorker {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (seen === 500) {
|
if (seen === 500) {
|
||||||
|
this._throttlingEnabled = true
|
||||||
MetricsReporter.reportEvent({
|
MetricsReporter.reportEvent({
|
||||||
nylasId,
|
nylasId,
|
||||||
type: 'imap',
|
type: 'imap',
|
||||||
|
@ -99,6 +101,10 @@ class SyncWorker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throttlingEnabled() {
|
||||||
|
return this._throttlingEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
_getInboxFolder() {
|
_getInboxFolder() {
|
||||||
return this._db.Folder.find({where: {role: ['all', 'inbox']}})
|
return this._db.Folder.find({where: {role: ['all', 'inbox']}})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue