Skip to content

Commit

Permalink
fix hacky lambdas
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdunnjpl committed Sep 8, 2023
1 parent 2793c2c commit a7d6a84
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/pds/registrysweepers/utils/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,21 @@ def query_registry_db(
scroll_id = None
while more_data_exists:
if scroll_id is None:
fetch_func = lambda: client.search( # noqa: E731
index=index_name,
body=query,
scroll=scroll_keepalive,
size=page_size,
_source_includes=_source.get("includes", []), # TODO: Break out from the enclosing _source object
_source_excludes=_source.get("excludes", []), # TODO: Break out from the enclosing _source object
)

def fetch_func():
return client.search(
index=index_name,
body=query,
scroll=scroll_keepalive,
size=page_size,
_source_includes=_source.get("includes", []), # TODO: Break out from the enclosing _source object
_source_excludes=_source.get("excludes", []), # TODO: Break out from the enclosing _source object
)

else:
fetch_func = lambda: client.scroll(scroll_id=scroll_id, scroll=scroll_keepalive) # noqa: E731, B023

def fetch_func(_scroll_id: str = scroll_id):
return client.scroll(scroll_id=_scroll_id, scroll=scroll_keepalive)

results = retry_call(
fetch_func,
Expand Down

0 comments on commit a7d6a84

Please sign in to comment.