Revert "[client-app] Properly re-index threads when their data has changed"

Temporarily reverting this commit for 1.0.30 release because it is causing
performance issues: https://phab.nylas.com/T7910

This reverts commit 5e35d39eb2.
This commit is contained in:
Juan Tejada 2017-02-28 10:35:58 -08:00
parent 5714a23501
commit 0294db95cf

View file

@ -122,21 +122,12 @@ class ThreadSearchIndexStore {
if (change.objectClass !== Thread.name) {
return;
}
_.defer(async () => {
_.defer(() => {
const {objects, type} = change
const threads = objects;
let promises = []
if (type === 'persist') {
const alreadyIndexedThreads = threads.filter(t => t.isSearchIndexed)
if (alreadyIndexedThreads.length > 0) {
alreadyIndexedThreads.forEach(thread => {
// Mark already indexed threads as unindexed so that we re-index them
// with updates
thread.isSearchIndexed = false
})
await DatabaseStore.inTransaction(t => t.persistModels(alreadyIndexedThreads))
}
this.indexer.notifyHasIndexingToDo();
} else if (type === 'unpersist') {
promises = threads.map(thread => this.unindexThread(thread,