Because the indexer processes Notes in bulk and after the fact, it could be the case where a new draft and a deletion event happen one after the other. If we don't re-check for deletions, the app will reindex the old draft that was already deleted by the LocalCache, creating a memory leak.
This commit is contained in:
+1
-1
@@ -199,7 +199,7 @@ class DraftEventHandler(
|
|||||||
eventNote: Note,
|
eventNote: Note,
|
||||||
publicNote: Note,
|
publicNote: Note,
|
||||||
) {
|
) {
|
||||||
if (event.pubKey == account.signer.pubKey && !event.isDeleted()) {
|
if (event.pubKey == account.signer.pubKey && !event.isDeleted() && !LocalCache.deletionIndex.hasBeenDeleted(event)) {
|
||||||
val rumor = account.draftsDecryptionCache.preCachedDraft(event) ?: account.draftsDecryptionCache.cachedDraft(event)
|
val rumor = account.draftsDecryptionCache.preCachedDraft(event) ?: account.draftsDecryptionCache.cachedDraft(event)
|
||||||
rumor?.let { indexDraftAsRealEvent(eventNote, it) }
|
rumor?.let { indexDraftAsRealEvent(eventNote, it) }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user