Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Fix incorrect default production data refresh limit of 0 (#3515)

Staci Mullins7131b3502ca0
diff --git a/ingestion_server/ingestion_server/distributed_reindex_scheduler.py b/ingestion_server/ingestion_server/distributed_reindex_scheduler.py
index 54d4d0178..9bd3eb491 100644
--- a/ingestion_server/ingestion_server/distributed_reindex_scheduler.py
+++ b/ingestion_server/ingestion_server/distributed_reindex_scheduler.py
@@ -42,9 +42,11 @@ def _assign_work(db_conn, workers, model_name, table_name, target_index):
cur.execute(est_records_query)
estimated_records = cur.fetchone()[0]
- records_per_worker = math.floor(
- min(estimated_records, get_record_limit()) / len(workers)
- )
+ # If a record_limit has been set, cap the number of records to be indexed.
+ if record_limit := get_record_limit():
+ estimated_records = min(estimated_records, record_limit)
+
+ records_per_worker = math.floor(estimated_records / len(workers))
worker_url_template = "http://{}:8002"
# Wait for the workers to start.
diff --git a/ingestion_server/ingestion_server/utils/config.py b/ingestion_server/ingestion_server/utils/config.py
index 45c2aaf58..11b45e568 100644
--- a/ingestion_server/ingestion_server/utils/config.py
+++ b/ingestion_server/ingestion_server/utils/config.py
@@ -14,6 +14,6 @@ def get_record_limit():
environment = config("ENVIRONMENT", default="local").lower()
if environment in {"prod", "production"}:
- return 0
+ return None
return 100_000