Skip to content

Commit 89281c7

Browse files
Reuse cached API response in fallback_install_lts() instead of duplicate curl call
Agent-Logs-Url: https://github.com/devcontainers/features/sessions/378f0238-8442-4236-bfa1-87679290da67 Co-authored-by: Kaniska244 <186041440+Kaniska244@users.noreply.github.com>
1 parent ced1109 commit 89281c7

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/java/install.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,19 @@ updaterc() {
197197

198198
# Fallback to LTS version when the latest feature release is not available
199199
# in either ms or tem distributions. Handles the full installation directly.
200+
# Reuses the global all_versions variable already fetched by find_version_list().
200201
fallback_install_lts() {
201202
local install_type=$1
202203
local prefix=$2
203204
local suffix=$3
204205
local set_as_default=$4
205206

207+
# Reuse the API response already fetched by find_version_list()
208+
if [ -z "${all_versions}" ]; then
209+
return 1
210+
fi
211+
206212
check_packages jq
207-
local all_versions
208-
all_versions=$(curl -s https://api.adoptium.net/v3/info/available_releases)
209213
local most_recent_lts
210214
most_recent_lts=$(echo "$all_versions" | jq -r '.most_recent_lts')
211215
local most_recent_feature

0 commit comments

Comments
 (0)