Change thumbnail cache to use a LIFO queue

This should fix the problem of covers being rendered slowly at the end
when scrolling through a very large number of covers very quickly.
This commit is contained in:
Kovid Goyal 2013-09-02 09:32:27 +05:30
parent 9d848e14a7
commit 528a1617de

View File

@ -10,7 +10,7 @@ import itertools, operator, os
from types import MethodType from types import MethodType
from time import time from time import time
from threading import Event, Thread from threading import Event, Thread
from Queue import Queue from Queue import LifoQueue
from functools import wraps, partial from functools import wraps, partial
from textwrap import wrap from textwrap import wrap
@ -313,7 +313,7 @@ class CoverDelegate(QStyledItemDelegate):
self.animation.setDuration(500) self.animation.setDuration(500)
self.set_dimensions() self.set_dimensions()
self.cover_cache = CoverCache(limit=gprefs['cover_grid_cache_size']) self.cover_cache = CoverCache(limit=gprefs['cover_grid_cache_size'])
self.render_queue = Queue() self.render_queue = LifoQueue()
self.animating = None self.animating = None
self.highlight_color = QColor(Qt.white) self.highlight_color = QColor(Qt.white)