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

[AutoBuild] Allow limiting concurrency of ghr uploads #1334

Merged
merged 1 commit into from
Jun 29, 2024
Merged
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
13 changes: 8 additions & 5 deletions src/AutoBuild.jl
Original file line number Diff line number Diff line change
Expand Up @@ -488,13 +488,16 @@
attempts::Int = 3, verbose::Bool = false)
for attempt in 1:attempts
try
ghr() do ghr_path
run(`$ghr_path -u $(dirname(repo)) -r $(basename(repo)) -t $(gh_auth.token) $(tag) $(path)`)
end
# Note: in some cases we may want to reduce/avoid concurrency to avoid exceeding
# secondary rate limits:
# https://docs.github.com/en/rest/using-the-rest-api/best-practices-for-using-the-rest-api?apiVersion=2022-11-28#avoid-concurrent-requests
# https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#about-secondary-rate-limits
concurrency = get(ENV, "BINARYBUILDER_GHR_CONCURRENCY", string(Sys.CPU_THREADS))
run(`$(ghr()) -u $(dirname(repo)) -r $(basename(repo)) -t $(gh_auth.token) -p $(concurrency) $(tag) $(path)`)

Check warning on line 496 in src/AutoBuild.jl

View check run for this annotation

Codecov / codecov/patch

src/AutoBuild.jl#L495-L496

Added lines #L495 - L496 were not covered by tests
return
catch
if verbose
@info("`ghr` upload step failed, beginning attempt #$(attempt)...")
if verbose && attempt < attempts
@info("`ghr` upload step failed, beginning attempt #$(attempt + 1)...")

Check warning on line 500 in src/AutoBuild.jl

View check run for this annotation

Codecov / codecov/patch

src/AutoBuild.jl#L499-L500

Added lines #L499 - L500 were not covered by tests
end
end
end
Expand Down
Loading