Skip to content

Conversation

ericphanson
Copy link
Contributor

closes #231

written with claude code, though with a lot of hand-holding.

Example of hitting the rate limit in real life:

julia> commits(Repo("JuliaRegistries/RegistryCI.jl"));
┌ Info: GitHub API primary rate limit hit, retrying in 3070.6s
│   method = "GET"
│   url = "https://api.github.com/repositories/208115424/commits?page=27"
│   status = 403
│   limit = "60"
│   remaining = "0"
│   used = "60"
│   reset = "1759013549"
└   resource = "core"
^CERROR: InterruptException:
Stacktrace:
  [1] try_yieldto(undo::typeof(Base.ensure_rescheduled))
    @ Base ./task.jl:958
  [2] wait()
    @ Base ./task.jl:1022
  [3] wait(c::Base.GenericCondition{Base.Threads.SpinLock}; first::Bool)
    @ Base ./condition.jl:130
  [4] wait
    @ ./condition.jl:125 [inlined]
  [5] _trywait(t::Timer)
    @ Base ./asyncevent.jl:145
  [6] wait
    @ ./asyncevent.jl:162 [inlined]
  [7] sleep(sec::Float64)
    @ Base ./asyncevent.jl:272
  [8] with_retries(f::GitHub.var"#21#23"{}; method::String, url::SubString{…}, max_retries::Int64, verbose::Bool)
    @ GitHub ~/GitHub.jl/src/utils/requests.jl:253
  [9] with_retries
    @ ~/GitHub.jl/src/utils/requests.jl:214 [inlined]
 [10] make_request_with_retries
    @ ~/GitHub.jl/src/utils/requests.jl:331 [inlined]
 [11] github_paged_get(api::GitHub.GitHubWebAPI, endpoint::String; page_limit::Float64, start_page::String, handle_error::Bool, auth::GitHub.AnonymousAuth, headers::Dict{…}, params::Dict{…}, max_retries::Int64, options::@Kwargs{})
    @ GitHub ~/GitHub.jl/src/utils/requests.jl:350
 [12] github_paged_get
    @ ~/GitHub.jl/src/utils/requests.jl:322 [inlined]
 [13] gh_get_paged_json(api::GitHub.GitHubWebAPI, endpoint::String; options::@Kwargs{})
    @ GitHub ~/GitHub.jl/src/utils/requests.jl:368
 [14] gh_get_paged_json
    @ ~/GitHub.jl/src/utils/requests.jl:367 [inlined]
 [15] commits(api::GitHub.GitHubWebAPI, repo::Repo; options::@Kwargs{})
    @ GitHub ~/GitHub.jl/src/repositories/commits.jl:32
 [16] commits
    @ ~/GitHub.jl/src/repositories/commits.jl:31 [inlined]
 [17] commits(repo::Repo)
    @ GitHub ./none:0
 [18] top-level scope
    @ REPL[5]:1
Some type information was truncated. Use `show(err)` to see complete types.

@ericphanson
Copy link
Contributor Author

ericphanson commented Sep 28, 2025

I think I should add a limit that if we want to sleep more than say 15 mins, we error instead with a clear error message. Since in many cases it would be unexpected that your task will just sleep for 12 hours or something like that. Super long waits can happen when you use up your quota and it wants to wait for a refresh. This value could be configurable with some “reasonable” default.

edit: done in 416b21e

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.

Respect GitHub's rate limit headers
1 participant