From 852e290f50b35d56be0d8dfaa9f8092cbf37ee36 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 13 Apr 2020 19:00:36 -0300 Subject: Fix code for disabling mirrors on network errors The idea is to try each mirror in order, but when one fails with a network error we mark it so we don't keep trying on each dependency. The logic was wrong in that it marked the entire entry (consisting of multiple mirrors) instead of marking mirrors individually. Closes #1179. --- src/luarocks/search.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/luarocks/search.lua b/src/luarocks/search.lua index 99a969c1..d2bad630 100644 --- a/src/luarocks/search.lua +++ b/src/luarocks/search.lua @@ -143,18 +143,18 @@ function search.search_repos(query, lua_version) local result_tree = {} for _, repo in ipairs(cfg.rocks_servers) do - if not cfg.disabled_servers[repo] then - if type(repo) == "string" then - repo = { repo } - end - for _, mirror in ipairs(repo) do + if type(repo) == "string" then + repo = { repo } + end + for _, mirror in ipairs(repo) do + if not cfg.disabled_servers[mirror] then local protocol, pathname = dir.split_url(mirror) if protocol == "file" then mirror = pathname end local ok, err, errcode = remote_manifest_search(result_tree, mirror, query, lua_version) if errcode == "network" then - cfg.disabled_servers[repo] = true + cfg.disabled_servers[mirror] = true end if ok then break -- cgit v1.2.3-55-g6feb