aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/luarocks/core/cfg.lua5
-rw-r--r--src/luarocks/fs/lua.lua10
2 files changed, 10 insertions, 5 deletions
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua
index c420c5bd..acda1e46 100644
--- a/src/luarocks/core/cfg.lua
+++ b/src/luarocks/core/cfg.lua
@@ -188,8 +188,9 @@ local function make_defaults(lua_version, target_cpu, platforms, home)
188 hooks_enabled = true, 188 hooks_enabled = true,
189 deps_mode = "one", 189 deps_mode = "one",
190 check_certificates = false, 190 check_certificates = false,
191 191
192 cache_timeout = 10, 192 cache_timeout = 60,
193 cache_fail_timeout = 86400,
193 version_check_on_fail = true, 194 version_check_on_fail = true,
194 195
195 lua_modules_path = "/share/lua/"..lua_version, 196 lua_modules_path = "/share/lua/"..lua_version,
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua
index 71529cc0..22bffce0 100644
--- a/src/luarocks/fs/lua.lua
+++ b/src/luarocks/fs/lua.lua
@@ -779,11 +779,15 @@ local function http_request(url, filename, http, cache)
779 if status or timestamp then 779 if status or timestamp then
780 local unixtime = read_timestamp(filename..".unixtime") 780 local unixtime = read_timestamp(filename..".unixtime")
781 if unixtime then 781 if unixtime then
782 if os.time() - unixtime < cfg.cache_timeout then 782 local diff = os.time() - tonumber(unixtime)
783 if status then 783 if status then
784 if diff < cfg.cache_fail_timeout then
784 return nil, status, {} 785 return nil, status, {}
785 end 786 end
786 return true, nil, nil, true 787 else
788 if diff < cfg.cache_timeout then
789 return true, nil, nil, true
790 end
787 end 791 end
788 end 792 end
789 793