mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-11 10:38:11 +08:00
[client-app] Don't compute thread search index size on startup
Summary: We did this to see if we should clear the index, which no longer makes sense because the index never exceeds our threshold. Additionally, none of the other search indexes do this. This was causing us to spend a ton of time scanning the ThreadSearch table at startup. Test Plan: Run locally, make sure things are fine Reviewers: evan, spang, juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D4007
This commit is contained in:
parent
84a3b20839
commit
7b55691cee
2 changed files with 1 additions and 15 deletions
|
@ -64,15 +64,7 @@ class ThreadSearchIndexStore {
|
|||
.then(() => this.buildIndex(this.accountIds))
|
||||
}
|
||||
|
||||
return DatabaseStore.searchIndexSize(Thread)
|
||||
.then((size) => {
|
||||
console.log(`Thread Search: Current index size is ${(size || 0)} threads`)
|
||||
if (this._isInvalidSize(size)) {
|
||||
return this.clearIndex().thenReturn(this.accountIds)
|
||||
}
|
||||
return this.getUnindexedAccounts()
|
||||
})
|
||||
.then((accountIds) => this.buildIndex(accountIds))
|
||||
return this.getUnindexedAccounts().then((accountIds) => this.buildIndex(accountIds));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -729,12 +729,6 @@ class DatabaseStore extends NylasStore {
|
|||
return this._query(sql);
|
||||
}
|
||||
|
||||
searchIndexSize(klass) {
|
||||
const searchTableName = `${klass.name}Search`;
|
||||
const sql = `SELECT COUNT(content_id) as count FROM \`${searchTableName}\``;
|
||||
return this._query(sql).then((result) => result[0].count);
|
||||
}
|
||||
|
||||
isIndexEmptyForAccount(accountId, modelKlass) {
|
||||
const modelTable = modelKlass.name
|
||||
const sql = (
|
||||
|
|
Loading…
Reference in a new issue