Skip to content

fix: replace fixed 3s sleep with load event + 0.5s in get_md - #25

Merged
g-eoj merged 1 commit into
mainfrom
fix/page-load-sleep
Feb 27, 2026
Merged

fix: replace fixed 3s sleep with load event + 0.5s in get_md#25
g-eoj merged 1 commit into
mainfrom
fix/page-load-sleep

Conversation

@g-eoj

@g-eoj g-eoj commented Feb 27, 2026

Copy link
Copy Markdown
Owner

wait_until="commit" + asyncio.sleep(3) was fragile — slow pages could still be loading, fast pages wasted time.

Switching to wait_until="load" (waits for HTML/CSS/images) + a 0.5s sleep for JS rendering. Most research sources are server-rendered so 0.5s is sufficient.

Also adds *.ipynb to .gitignore.

Closes #4

Greptile Summary

Improved page loading reliability in get_md() by switching from wait_until="commit" to wait_until="load" and reducing sleep time from 3s to 0.5s.

  • Replaced fragile timing approach that could fail on slow pages or waste time on fast pages
  • wait_until="load" waits for HTML/CSS/images before proceeding (more robust than "commit")
  • 0.5s sleep is sufficient for JS rendering on server-rendered research sources
  • Added *.ipynb to .gitignore for local notebook experiments

Confidence Score: 5/5

  • This PR is safe to merge with no issues found
  • The changes are well-reasoned and improve both reliability and performance. The switch to wait_until="load" is more robust than the previous "commit" approach, and the reduced sleep time (0.5s vs 3s) is appropriate for the stated use case of server-rendered pages. The .gitignore addition is standard practice. No logic, syntax, or security issues detected.
  • No files require special attention

Important Files Changed

Filename Overview
.gitignore Added *.ipynb to ignore Jupyter notebooks - standard practice
api/librarian/_tools.py Replaced fragile 3s fixed sleep with wait_until="load" + 0.5s for JS rendering - more reliable and efficient

Last reviewed commit: 8d728c1

@g-eoj
g-eoj merged commit 25cc2fc into main Feb 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fixed 3-second sleep for page load is fragile

1 participant