NoteCache: Avoid duplicates

This should ideally never happen, but it seems to be occasionally happening
for some reason.
This commit is contained in:
Vishesh Handa
2020-05-14 16:59:03 +02:00
parent 89deac3770
commit 87393ac588

View File

@ -85,7 +85,9 @@ class NotesCache {
var heap = HeapPriorityQueue<Note>(reversedFn);
for (var note in allNotes) {
heap.add(note);
if (!heap.contains(note)) {
heap.add(note);
}
if (heap.length > CACHE_SIZE) {
heap.removeFirst();
}