forked from Mirrorlandia_minetest/minetest
Don't run CDB update_detector more than once (#14214)
This commit is contained in:
parent
34ce86a8f5
commit
15f73258fd
@ -28,6 +28,13 @@ end
|
|||||||
|
|
||||||
local has_fetched = false
|
local has_fetched = false
|
||||||
local latest_releases
|
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()
|
local function fetch_latest_releases()
|
||||||
@ -89,8 +96,9 @@ local function fetch()
|
|||||||
has_fetched = false
|
has_fetched = false
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
latest_releases = lowercase_keys(releases)
|
latest_releases = lowercase_keys(releases)
|
||||||
|
core.set_once("cdb_latest_releases", core.serialize(latest_releases))
|
||||||
|
|
||||||
if update_detector.get_count() > 0 then
|
if update_detector.get_count() > 0 then
|
||||||
local maintab = ui.find_by_name("maintab")
|
local maintab = ui.find_by_name("maintab")
|
||||||
if not maintab.hidden then
|
if not maintab.hidden then
|
||||||
|
@ -38,7 +38,9 @@ Functions
|
|||||||
---------
|
---------
|
||||||
|
|
||||||
* `core.start()`
|
* `core.start()`
|
||||||
|
* start game session
|
||||||
* `core.close()`
|
* `core.close()`
|
||||||
|
* exit engine
|
||||||
* `core.get_min_supp_proto()`
|
* `core.get_min_supp_proto()`
|
||||||
* returns the minimum supported network protocol version
|
* returns the minimum supported network protocol version
|
||||||
* `core.get_max_supp_proto()`
|
* `core.get_max_supp_proto()`
|
||||||
@ -53,6 +55,10 @@ Functions
|
|||||||
* Android only. Shares file using the share popup
|
* Android only. Shares file using the share popup
|
||||||
* `core.get_version()` (possible in async calls)
|
* `core.get_version()` (possible in async calls)
|
||||||
* returns current core version
|
* 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`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user