mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Randomize the order in which plugins are added to the search queue. This way plugins with a lower letter do not have an unfair advantage.
This commit is contained in:
parent
d459367526
commit
0b565f3975
@ -7,7 +7,8 @@ __docformat__ = 'restructuredtext en'
|
||||
import re
|
||||
import time
|
||||
from contextlib import closing
|
||||
from threading import Event, Thread
|
||||
from random import shuffle
|
||||
from threading import Thread
|
||||
from Queue import Queue
|
||||
|
||||
from PyQt4.Qt import Qt, QAbstractItemModel, QDialog, QTimer, QVariant, \
|
||||
@ -87,7 +88,11 @@ class SearchDialog(QDialog, Ui_Dialog):
|
||||
if not query.strip():
|
||||
return
|
||||
|
||||
for n in self.store_plugins:
|
||||
store_names = self.store_plugins.keys()
|
||||
if not store_names:
|
||||
return
|
||||
shuffle(store_names)
|
||||
for n in store_names:
|
||||
if getattr(self, 'store_check_' + n).isChecked():
|
||||
self.search_pool.add_task(query, n, self.store_plugins[n], TIMEOUT)
|
||||
if self.search_pool.has_tasks():
|
||||
|
Loading…
x
Reference in New Issue
Block a user