From 5181bf9e574b445c7816bd4d6b16ff5653bcfb2f Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 12 Sep 2018 19:28:44 +0200 Subject: fix progress indicator print the grand total since we fetch mirrors async --- generate-json.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'generate-json.lua') diff --git a/generate-json.lua b/generate-json.lua index f8448ba..d43ba3e 100755 --- a/generate-json.lua +++ b/generate-json.lua @@ -8,6 +8,8 @@ local utils = require("utils") local conf = require("config") local cqueues = require("cqueues") +local total_indexes = 0 + ---- -- convert apkindex list to a table function get_apkindexes() @@ -84,7 +86,7 @@ end function progress(num) if arg[1] == "debug" then num = (num < 10) and "0"..num or num - io.write(("Indexes left: %s\r"):format(num)) + io.write(("Indexes left: %s \r"):format(num)) io.flush() end end @@ -96,6 +98,7 @@ function check_apkindexes(mirror) local qty = 0 local cnt = 0 local allowed_archs = utils.to_list(conf.archs) + total_indexes = total_indexes + num_indexes for branch in utils.kpairs(indexes, utils.sort_branch) do local repos = {} for repo in utils.kpairs(indexes[branch], utils.sort_repo) do @@ -108,7 +111,8 @@ function check_apkindexes(mirror) if status == "200" then qty = qty+1 end end cnt = cnt + 1 - progress(num_indexes-cnt) + total_indexes = total_indexes - 1 + progress(total_indexes) end table.insert(repos, {name=repo, arch=archs}) end -- cgit v1.2.3