diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2019-04-03 14:00:13 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2019-04-09 16:49:20 -0300 |
commit | 3707b0245c1952d4a7a2ba2314c552d2195fe128 (patch) | |
tree | 77564d2530b096fd1bd654d49a1b0d19f9694f91 /src | |
parent | 208c5528289b2f69f03b70a1ea6f979d675882a9 (diff) | |
download | luarocks-3707b0245c1952d4a7a2ba2314c552d2195fe128.tar.gz luarocks-3707b0245c1952d4a7a2ba2314c552d2195fe128.tar.bz2 luarocks-3707b0245c1952d4a7a2ba2314c552d2195fe128.zip |
fs: separate cache_timeout and cache_fail_timeout
Makes failure to search for manifest-5.4 cache for a full day.
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/core/cfg.lua | 5 | ||||
-rw-r--r-- | src/luarocks/fs/lua.lua | 10 |
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 | ||