Skip to content

Commit

Permalink
Fix incorrect default production data refresh limit of 0 (#3515)
Browse files Browse the repository at this point in the history
* Only cap the number of records to index if a limit has been set

* Use None instead of 0 to signify no record limit for clarity
  • Loading branch information
stacimc authored Dec 12, 2023
1 parent c6ce2c6 commit 7131b35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion ingestion_server/ingestion_server/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7131b35

Please sign in to comment.