diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py index 7d8a8624a9..a9ef6a4281 100644 --- a/src/calibre/library/caches.py +++ b/src/calibre/library/caches.py @@ -67,6 +67,11 @@ class MetadataBackup(Thread): # {{{ prints('Failed to get backup metadata for id:', id_, 'again, giving up') traceback.print_exc() continue + + # Give the GUI thread a chance to do something. Python threads don't + # have priorities, so this thread would naturally keep the processor + # until some scheduling event happens. The sleep makes such an event + time.sleep(0.010) try: print 'now do metadata' raw = metadata_to_opf(mi) @@ -75,6 +80,7 @@ class MetadataBackup(Thread): # {{{ traceback.print_exc() continue + time.sleep(0.010) # Give the GUI thread a chance to do something try: self.do_write(path, raw) except: @@ -87,6 +93,7 @@ class MetadataBackup(Thread): # {{{ 'again, giving up') continue + time.sleep(0.010) # Give the GUI thread a chance to do something try: self.clear_dirtied([id_]) except: