Don't run CDB update_detector more than once (#14214)

This commit is contained in:
sfan5 2024-01-05 00:40:11 +01:00 committed by GitHub
parent 34ce86a8f5
commit 15f73258fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

@ -28,6 +28,13 @@ end
local has_fetched = false
local latest_releases
do
local tmp = core.get_once("cdb_latest_releases")
if tmp then
latest_releases = core.deserialize(tmp, true)
has_fetched = latest_releases ~= nil
end
end
local function fetch_latest_releases()
@ -89,8 +96,9 @@ local function fetch()
has_fetched = false
return
end
latest_releases = lowercase_keys(releases)
core.set_once("cdb_latest_releases", core.serialize(latest_releases))
if update_detector.get_count() > 0 then
local maintab = ui.find_by_name("maintab")
if not maintab.hidden then

@ -38,7 +38,9 @@ Functions
---------
* `core.start()`
* start game session
* `core.close()`
* exit engine
* `core.get_min_supp_proto()`
* returns the minimum supported network protocol version
* `core.get_max_supp_proto()`
@ -53,6 +55,10 @@ Functions
* Android only. Shares file using the share popup
* `core.get_version()` (possible in async calls)
* returns current core version
* `core.set_once(key, value)`:
* save a string value that persists even if menu is closed
* `core.get_once(key)`:
* get a string value saved by above function, or `nil`