mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 16:54:28 +02: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
1 changed files with 7 additions and 2 deletions
|
|
@ -7,7 +7,8 @@
|
|||
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 @@ def do_search(self, checked=False):
|
|||
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…
Reference in a new issue