Merge pull request #250 from Reiling-Jeff/main
fix(arch-updater): reduce CPU work in the HTTP callback
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
id = "yuuto/arch-updater"
|
||||
name = "Arch Updater"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
plugin_api = 9
|
||||
author = "yuuto"
|
||||
license = "MIT"
|
||||
|
||||
@@ -54,6 +54,7 @@ local sinceCheck = 0
|
||||
local startupTicks = 0
|
||||
local sinceNewsCheck = 0
|
||||
local newsStateLoaded = false
|
||||
local newsDirty = false
|
||||
|
||||
local startCheck
|
||||
local checkNews
|
||||
@@ -537,7 +538,7 @@ checkNews = function()
|
||||
local parsed, items = pcall(parseNewsFeed, res.body)
|
||||
if parsed and type(items) == "table" then
|
||||
applyNewsItems(items)
|
||||
publish()
|
||||
newsDirty = true
|
||||
end
|
||||
end)
|
||||
if not ok then
|
||||
@@ -737,6 +738,11 @@ function update()
|
||||
checkNews()
|
||||
end
|
||||
end
|
||||
|
||||
if newsDirty then
|
||||
newsDirty = false
|
||||
publish()
|
||||
end
|
||||
end
|
||||
|
||||
noctalia.setUpdateInterval(1000)
|
||||
|
||||
Reference in New Issue
Block a user