Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempted fix of learn-astropy workflow failure #56

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Mac OS
.DS_Store

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
10 changes: 5 additions & 5 deletions astropylibrarian/workflows/expirerecords.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async def expire_old_records(
filters = (
f"root_url:{escape_facet_value(root_url)}"
" AND NOT "
f"root_url:{escape_facet_value(root_url)}"
f"index_epoch:{escape_facet_value(index_epoch)}"
)

obj = BrowseParamsObject(
Expand All @@ -36,12 +36,12 @@ async def expire_old_records(
attributes_to_highlight=[],
)
old_object_ids: List[str] = []
for r in await algolia_index.browse_objects(obj):
async for r in algolia_index.browse_objects(obj):
# Double check that we're deleting the right things.
if r["root_url"] != root_url:
logger.warning("root_url does not match: %s", r["baseUrl"])
logger.warning("root_url does not match: %s", r["root_url"])
continue
if r["surrogateKey"] == index_epoch:
if r["index_epoch"] == index_epoch:
logger.warning("index_epoch matches current epoch: %s", r["index_epoch"])
continue
old_object_ids.append(r["objectID"])
Expand All @@ -56,4 +56,4 @@ async def expire_old_records(

logger.info("Finished deleting expired objects for %s", root_url)

return old_object_ids
return old_object_ids
Loading