forked from zaclys/searxng
[fix] make sure then engine name is lower case
Minor fix: "%s engine initialized" display the right engine name
This commit is contained in:
parent
8645ef717e
commit
23611897ec
|
@ -57,11 +57,16 @@ engine_default_args = {'paging': False,
|
||||||
|
|
||||||
|
|
||||||
def load_engine(engine_data):
|
def load_engine(engine_data):
|
||||||
|
engine_name = engine_data['name']
|
||||||
if '_' in engine_data['name']:
|
if '_' in engine_name:
|
||||||
logger.error('Engine name conains underscore: "{}"'.format(engine_data['name']))
|
logger.error('Engine name contains underscore: "{}"'.format(engine_name))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
if engine_name.lower() != engine_name:
|
||||||
|
logger.warn('Engine name is not lowercase: "{}", converting to lowercase'.format(engine_name))
|
||||||
|
engine_name = engine_name.lower()
|
||||||
|
engine_data['name'] = engine_name
|
||||||
|
|
||||||
engine_module = engine_data['engine']
|
engine_module = engine_data['engine']
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -248,12 +253,14 @@ def load_engines(engine_list):
|
||||||
|
|
||||||
def initialize_engines(engine_list):
|
def initialize_engines(engine_list):
|
||||||
load_engines(engine_list)
|
load_engines(engine_list)
|
||||||
|
|
||||||
|
def engine_init(engine_name, init_fn):
|
||||||
|
init_fn()
|
||||||
|
logger.debug('%s engine: Initialized', engine_name)
|
||||||
|
|
||||||
for engine_name, engine in engines.items():
|
for engine_name, engine in engines.items():
|
||||||
if hasattr(engine, 'init'):
|
if hasattr(engine, 'init'):
|
||||||
init_fn = getattr(engine, 'init')
|
init_fn = getattr(engine, 'init')
|
||||||
|
if init_fn:
|
||||||
def engine_init():
|
logger.debug('%s engine: Starting background initialization', engine_name)
|
||||||
init_fn()
|
threading.Thread(target=engine_init, args=(engine_name, init_fn)).start()
|
||||||
logger.debug('%s engine initialized', engine_name)
|
|
||||||
logger.debug('Starting background initialization of %s engine', engine_name)
|
|
||||||
threading.Thread(target=engine_init).start()
|
|
||||||
|
|
Loading…
Reference in New Issue