Skip to content

Commit

Permalink
Use x-total-records in ingest
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer committed Sep 22, 2024
1 parent a765cff commit 35e63ed
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ingest/scripts/call_loculus.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ def get_submitted(config: Config):
logger.info("Getting previously submitted sequences")

response = make_request(HTTPMethod.GET, url, config, params=params)
expected_record_count = int(response.headers["x-total-records"])

entries: list[dict[str, Any]] = []
try:
Expand All @@ -327,6 +328,10 @@ def get_submitted(config: Config):
logger.error(f"Error decoding JSON from /get-original-metadata: {response_summary}")
raise ValueError from err

if len(entries) != expected_record_count:
logger.error("Got incomplete original metadata stream")
raise ValueError

# Initialize the dictionary to store results
submitted_dict: dict[str, dict[str, str | list]] = {}

Expand Down

0 comments on commit 35e63ed

Please sign in to comment.