mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 01:45:55 +08:00
NoteCache: Avoid duplicates
This should ideally never happen, but it seems to be occasionally happening for some reason.
This commit is contained in:
@ -85,7 +85,9 @@ class NotesCache {
|
|||||||
var heap = HeapPriorityQueue<Note>(reversedFn);
|
var heap = HeapPriorityQueue<Note>(reversedFn);
|
||||||
|
|
||||||
for (var note in allNotes) {
|
for (var note in allNotes) {
|
||||||
heap.add(note);
|
if (!heap.contains(note)) {
|
||||||
|
heap.add(note);
|
||||||
|
}
|
||||||
if (heap.length > CACHE_SIZE) {
|
if (heap.length > CACHE_SIZE) {
|
||||||
heap.removeFirst();
|
heap.removeFirst();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user