1
0
forked from osmarks/potatOS

modify updater

This commit is contained in:
osmarks 2022-02-20 12:38:17 +00:00
parent 4d9f5632e1
commit a0702bb775

View File

@ -1141,7 +1141,7 @@ local function run_with_sandbox()
end, end,
-- Updates potatOS -- Updates potatOS
update = function() update = function()
return install(true) os.queueEvent("trigger_update", true)
end, end,
-- Messes up 1 out of 10 keypresses. -- Messes up 1 out of 10 keypresses.
evilify = function() evilify = function()
@ -1600,7 +1600,15 @@ return function(...)
if not ok then add_log("update error %s", err) end if not ok then add_log("update error %s", err) end
-- Spread out updates a bit to reduce load on the server. -- Spread out updates a bit to reduce load on the server.
sleep(300 + (os.getComputerID() % 100) - 50) local timer = os.startTimer(300 + (os.getComputerID() % 100) - 50)
while true do
local ev, arg = coroutine.yield { timer = true, trigger_update = true }
if ev == "timer" and arg == timer then
break
elseif ev == "trigger_update" then
pcall(install, arg)
end
end
end end
end, "potatoupd") end, "potatoupd")