diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2020-04-13 19:00:36 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2020-04-13 19:00:36 -0300 |
commit | 852e290f50b35d56be0d8dfaa9f8092cbf37ee36 (patch) | |
tree | f9a22945fd7d4760b770645dc2a18ec2c0cd2dc0 | |
parent | 33163294fb984abc20e7ee5713f7778231999ace (diff) | |
download | luarocks-852e290f50b35d56be0d8dfaa9f8092cbf37ee36.tar.gz luarocks-852e290f50b35d56be0d8dfaa9f8092cbf37ee36.tar.bz2 luarocks-852e290f50b35d56be0d8dfaa9f8092cbf37ee36.zip |
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.
-rw-r--r-- | src/luarocks/search.lua | 12 |
1 files changed, 6 insertions, 6 deletions
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) | |||
143 | 143 | ||
144 | local result_tree = {} | 144 | local result_tree = {} |
145 | for _, repo in ipairs(cfg.rocks_servers) do | 145 | for _, repo in ipairs(cfg.rocks_servers) do |
146 | if not cfg.disabled_servers[repo] then | 146 | if type(repo) == "string" then |
147 | if type(repo) == "string" then | 147 | repo = { repo } |
148 | repo = { repo } | 148 | end |
149 | end | 149 | for _, mirror in ipairs(repo) do |
150 | for _, mirror in ipairs(repo) do | 150 | if not cfg.disabled_servers[mirror] then |
151 | local protocol, pathname = dir.split_url(mirror) | 151 | local protocol, pathname = dir.split_url(mirror) |
152 | if protocol == "file" then | 152 | if protocol == "file" then |
153 | mirror = pathname | 153 | mirror = pathname |
154 | end | 154 | end |
155 | local ok, err, errcode = remote_manifest_search(result_tree, mirror, query, lua_version) | 155 | local ok, err, errcode = remote_manifest_search(result_tree, mirror, query, lua_version) |
156 | if errcode == "network" then | 156 | if errcode == "network" then |
157 | cfg.disabled_servers[repo] = true | 157 | cfg.disabled_servers[mirror] = true |
158 | end | 158 | end |
159 | if ok then | 159 | if ok then |
160 | break | 160 | break |