modify updater
This commit is contained in:
parent
4d9f5632e1
commit
a0702bb775
12
src/main.lua
12
src/main.lua
@ -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")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user