summaryrefslogtreecommitdiff
path: root/xmake
diff options
context:
space:
mode:
authorruki <[email protected]>2020-02-05 22:37:58 +0800
committerruki <[email protected]>2020-02-07 22:45:56 +0800
commit1cac0feefb18328d14deff5b1fddb95fc7175353 (patch)
tree73955166b48a21959622ea71f70b207dea3aa8ef /xmake
parent69a092643d7725dce1f6fbf7b90ddb3e6f15370e (diff)
improve runjobs timeout
Diffstat (limited to 'xmake')
-rw-r--r--xmake/actions/require/impl/package.lua2
-rw-r--r--xmake/modules/private/async/runjobs.lua7
2 files changed, 5 insertions, 4 deletions
diff --git a/xmake/actions/require/impl/package.lua b/xmake/actions/require/impl/package.lua
index beac43ec2..8da0e94df 100644
--- a/xmake/actions/require/impl/package.lua
+++ b/xmake/actions/require/impl/package.lua
@@ -633,7 +633,7 @@ function _install_packages(packages_install, packages_download)
packages_installing[index] = nil
packages_downloading[index] = nil
- end, {total = #packages_install, comax = (option.get("verbose") or option.get("diagnosis")) and 1 or 4, timeout = 300, timer = function (running_jobs_indices)
+ end, {total = #packages_install, comax = (option.get("verbose") or option.get("diagnosis")) and 1 or 4, timer = function (running_jobs_indices)
-- do not print progress info if be verbose
if option.get("verbose") or not show_wait then
diff --git a/xmake/modules/private/async/runjobs.lua b/xmake/modules/private/async/runjobs.lua
index b59bd3a35..1c12bf63c 100644
--- a/xmake/modules/private/async/runjobs.lua
+++ b/xmake/modules/private/async/runjobs.lua
@@ -28,6 +28,8 @@ function main(name, jobfunc, opt)
op = opt or {}
local total = opt.total or 1
local comax = opt.comax or total
+ local timeout = opt.timeout or 500
+ assert(timeout < 60000, "runjobs: invalid timeout!")
-- show waiting tips?
local waitindex = 0
@@ -42,10 +44,9 @@ function main(name, jobfunc, opt)
local stop = false
local running_jobs_indices
if opt.timer then
- assert(opt.timeout and opt.timeout < 60000, "runjobs: invalid timer timeout!")
scheduler.co_start_named(name .. "/timer", function ()
while not stop do
- os.sleep(opt.timeout)
+ os.sleep(timeout)
if not stop then
opt.timer(running_jobs_indices)
end
@@ -54,7 +55,7 @@ function main(name, jobfunc, opt)
elseif showtips then
scheduler.co_start_named(name .. "/tips", function ()
while not stop do
- os.sleep(opt.timeout or 300)
+ os.sleep(timeout)
if not stop then
waitindex = ((waitindex + 1) % #waitchars)
printf("\b" .. waitchars[waitindex + 1])