An open source, non-profit web search engine
Don't delete an index if the sizes don't match
Daoud Clarkec69108cfcc15
diff --git a/mwmbl/indexer/historical.py b/mwmbl/indexer/historical.pyindex 9386680..3af9e44 100644--- a/mwmbl/indexer/historical.py+++ b/mwmbl/indexer/historical.py@@ -4,7 +4,7 @@ from mwmbl.crawler.app import get_batches_for_datefrom mwmbl.database import Databasefrom mwmbl.indexer.indexdb import BatchInfo, BatchStatus, IndexDatabase-DAYS = 20+DAYS = 66def run():diff --git a/mwmbl/main.py b/mwmbl/main.pyindex 4bc82fa..fd93824 100644--- a/mwmbl/main.py+++ b/mwmbl/main.py@@ -40,14 +40,9 @@ def run():try:existing_index = TinyIndex(item_factory=Document, index_path=index_path)if existing_index.page_size != PAGE_SIZE or existing_index.num_pages != args.num_pages:- print(f"Existing index page sizes ({existing_index.page_size}) and number of pages "- f"({existing_index.num_pages}) does not match - removing.")- os.remove(index_path)- existing_index = None+ raise ValueError(f"Existing index page sizes ({existing_index.page_size}) or number of pages "+ f"({existing_index.num_pages}) do not match")except FileNotFoundError:- existing_index = None-- if existing_index is None:print("Creating a new index")TinyIndex.create(item_factory=Document, index_path=index_path, num_pages=args.num_pages, page_size=PAGE_SIZE)