fix(checker): dont check for updates when there's tasks with errors

This commit is contained in:
Folke Lemaitre 2023-01-23 19:17:30 +01:00
parent ed210702f5
commit c32a6185ac
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 11 additions and 9 deletions

View File

@ -13,7 +13,7 @@ M.reported = {}
function M.start() function M.start()
M.fast_check() M.fast_check()
if M.schedule() > 0 then if M.schedule() > 0 and not M.has_errors() then
Manage.log({ Manage.log({
clear = false, clear = false,
show = false, show = false,
@ -47,17 +47,19 @@ function M.fast_check(opts)
M.report(opts.report ~= false) M.report(opts.report ~= false)
end end
function M.has_errors()
for _, plugin in pairs(Config.plugins) do
if Plugin.has_errors(plugin) then
return true
end
end
return false
end
function M.check() function M.check()
State.checker.last_check = os.time() State.checker.last_check = os.time()
State.write() -- update state State.write() -- update state
local errors = false if M.has_errors() then
for _, plugin in pairs(Config.plugins) do
if Plugin.has_errors(plugin) then
errors = true
break
end
end
if errors then
M.schedule() M.schedule()
else else
Manage.check({ Manage.check({