aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-03-04 16:54:55 +0530
committersinanmohd <sinan@sinanmohd.com>2024-03-04 16:54:57 +0530
commit79f01d52d80ac168474fa42aabd2dab84e989ff7 (patch)
treee858ae3584ce50e99e9aac2e5756df839831bd9a /lib
parentd6540310e4cd12cba67b0c2e6c666d94dd91f367 (diff)
lib/curl: retire retries
it was mainly used for subscene, which is also retired
Diffstat (limited to 'lib')
-rw-r--r--lib/curl.lua19
1 files changed, 6 insertions, 13 deletions
diff --git a/lib/curl.lua b/lib/curl.lua
index f35fcf1..cfc1c11 100644
--- a/lib/curl.lua
+++ b/lib/curl.lua
@@ -17,7 +17,7 @@ local head_to_args = function (t)
return args
end
-local get = function (url, headr, args, tries)
+local get = function (url, headr, args)
local fetch, hcode, def_args
def_args = {
@@ -35,27 +35,20 @@ local get = function (url, headr, args, tries)
headr = util.table_merge(def_headr, headr)
args = util.array_merge(args, head_to_args(headr))
- repeat
- fetch = util.run(args)
- -- hcode can be nil, it means curl was't able to fulfill the http request, either
- -- because curl package is broken or mpv killed it prematurely. we can exit
- -- out of retry loop early if hcode is nil since there's no point in retrying
- hcode = fetch:match('%d*$')
-
- tries = tries - 1
- until hcode == '200' or not hcode or tries <= 0
-
+ fetch = util.run(args)
+ hcode = fetch:match('%d*$')
fetch = fetch:gsub('%s*%d*$', '')
+
return fetch, tonumber(hcode)
end
-local zip_link_to_file = function (url, headr, out, tries)
+local zip_link_to_file = function (url, headr, out)
local hcode, zip, rc, args
zip = os.tmpname()
args = { '-o'.. zip }
- _, hcode = get(url, headr, args, tries)
+ _, hcode = get(url, headr, args)
rc = (hcode == 200)
if rc then