135def initialize():
136 if hasattr(signal, 'SIGUSR1'):
137
138 logger.info('Send SIGUSR1 signal to pid %i to start the checker', os.getpid())
139 signal.signal(signal.SIGUSR1, _signal_handler)
140
141
142 if searx_debug and settings['checker']['off_when_debug']:
143 logger.info('debug mode: checker is disabled')
144 return
145
146
147 scheduling = settings['checker']['scheduling']
148 if scheduling is None or not scheduling:
149 logger.info('Checker scheduler is disabled')
150 return
151
152
153 if get_redis_client() is None:
154 logger.error('The checker requires Redis')
155 return
156
157
158 every_range = _get_interval(scheduling.get('every', (300, 1800)), 'checker.scheduling.every is not a int or list')
159 start_after_range = _get_interval(
160 scheduling.get('start_after', (300, 1800)), 'checker.scheduling.start_after is not a int or list'
161 )
162 t = threading.Thread(
163 target=scheduler_function,
164 args=(start_after_range[0], start_after_range[1], every_range[0], every_range[1], run),
165 name='checker_scheduler',
166 )
167 t.daemon = True
168 t.start()