-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat(pagination): do it #70
Conversation
axoupdater/src/lib.rs
Outdated
.json() | ||
.await?; | ||
let mut url = format!("{GITHUB_API}/repos/{owner}/{name}/releases"); | ||
let next_pattern = Regex::new(r#"/(?<=<)([\S]*)(?=>; rel="Next")"/i"#).expect("bad regex"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add a comment/citation/example for what's up with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for your own edification it was from the github API docs on their pagination: https://docs.github.com/en/rest/using-the-rest-api/using-pagination-in-the-rest-api?apiVersion=2022-11-28. i can't use it because it has look aheads/behinds and the rust regex crate doesn't support that apparently.
this is what the header looks like and i suspect you'll see why its such a pain in the ass to parse:
link: <https://api.github.com/repositories/1300192/issues?per_page=2&page=2>; rel="next", <https://api.github.com/repositories/1300192/issues?per_page=2&page=7715>; rel="last"
anyways you can see my crimes in the commit now that just fully eliminate the regex usage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks reasonable
36813be
to
68249e6
Compare
status: this apparently hits github api ratelimits :/ |
This mostly happens if we spam tests; we get 60 requests an hour for unauthenticated apps, which users are less likely to hit in normal circumstances. (I opened #73 to document this.) |
I've updated this with updates to the tests, to make sure we don't call it on platforms where the old version is unavailable. I've also added tests for the pagination parser. |
No description provided.