mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Dont scan font files in worker processes
This commit is contained in:
parent
8cf35971ae
commit
18805c4c68
@ -36,6 +36,7 @@ isunix = isosx or islinux
|
||||
isportable = os.environ.get('CALIBRE_PORTABLE_BUILD', None) is not None
|
||||
ispy3 = sys.version_info.major > 2
|
||||
isxp = iswindows and sys.getwindowsversion().major < 6
|
||||
isworker = os.environ.has_key('CALIBRE_WORKER') or os.environ.has_key('CALIBRE_SIMPLE_WORKER')
|
||||
|
||||
try:
|
||||
preferred_encoding = locale.getpreferredencoding()
|
||||
|
@ -12,7 +12,8 @@ from collections import defaultdict
|
||||
from threading import Thread
|
||||
|
||||
from calibre import walk, prints, as_unicode
|
||||
from calibre.constants import config_dir, iswindows, isosx, plugins, DEBUG
|
||||
from calibre.constants import (config_dir, iswindows, isosx, plugins, DEBUG,
|
||||
isworker)
|
||||
from calibre.utils.fonts.metadata import FontMetadata, UnsupportedFont
|
||||
from calibre.utils.fonts.utils import panose_to_css_generic_family
|
||||
from calibre.utils.icu import sort_key
|
||||
@ -150,7 +151,8 @@ class Scanner(Thread):
|
||||
if not hasattr(self, 'cache'):
|
||||
from calibre.utils.config import JSONConfig
|
||||
self.cache = JSONConfig('fonts/scanner_cache')
|
||||
self.cache.refresh()
|
||||
else:
|
||||
self.cache.refresh()
|
||||
if self.cache.get('version', None) != self.CACHE_VERSION:
|
||||
self.cache.clear()
|
||||
self.cached_fonts = self.cache.get('fonts', {})
|
||||
@ -162,6 +164,10 @@ class Scanner(Thread):
|
||||
self.reload_cache()
|
||||
num = 0
|
||||
for folder in self.folders:
|
||||
if isworker:
|
||||
# Dont scan font files in worker processes, use whatever is
|
||||
# cached.
|
||||
continue
|
||||
if not os.path.isdir(folder):
|
||||
continue
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user