Skip to content

Commit

Permalink
Refactors latest build API to reduce latency
Browse files Browse the repository at this point in the history
- removes usage for get_builds method in app which fetches all pages of
the response even if limitis set to 1
- this reduces latency of this request from minutes to seconds
  • Loading branch information
nid90 committed Nov 20, 2024
1 parent a923081 commit 77f14cb
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/app_store/connect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,16 @@ def update_build_notes(build_number:, notes: nil)

# no of api calls: 2
def latest_build
build = app.get_builds(includes: "preReleaseVersion,buildBetaDetail", sort: "-version").first
raise BuildNotFoundError.new("No build found for the app") unless build
build_data(build)
execute do
params = {
sort: "-version",
limit: 1,
filter: {app: app.id}
}
build = api.test_flight_request_client.get("builds", params)&.first
raise BuildNotFoundError.new("No build found for the app") unless build
build_data(build)
end
end

# no of api calls: 4-7
Expand Down

0 comments on commit 77f14cb

Please sign in to comment.