An open source, non-profit web search engine
Wrap background tasks in try/except
Daoud Clarkee9835edc452f
diff --git a/mwmbl/background.py b/mwmbl/background.pyindex 12a933e..858ea11 100644--- a/mwmbl/background.py+++ b/mwmbl/background.py@@ -1,15 +1,28 @@"""Script that updates data in a background process."""+from logging import getLogger+from mwmbl.indexer import historicalfrom mwmbl.indexer.preprocess import run_preprocessingfrom mwmbl.indexer.retrieve import retrieve_batchesfrom mwmbl.indexer.update_pages import run_update+logger = getLogger(__name__)+def run(index_path: str):historical.run()while True:- retrieve_batches()- run_preprocessing(index_path)- run_update(index_path)+ try:+ retrieve_batches()+ except Exception:+ logger.exception("Error retrieving batches")+ try:+ run_preprocessing(index_path)+ except Exception:+ logger.exception("Error preprocessing")+ try:+ run_update(index_path)+ except Exception:+ logger.exception("Error running index update")