Reload luci.config for each thread
This commit is contained in:
parent
b5bbc5041f
commit
4ef86cacad
1 changed files with 11 additions and 2 deletions
|
@ -25,9 +25,18 @@ limitations under the License.
|
|||
|
||||
]]--
|
||||
|
||||
local util = require "luci.util"
|
||||
module("luci.config",
|
||||
function(m)
|
||||
if pcall(require, "luci.model.uci") then
|
||||
setmetatable(m, {__index = luci.model.uci.cursor():get_all("luci")})
|
||||
local config = util.threadlocal()
|
||||
setmetatable(m, {
|
||||
__index = function(tbl, key)
|
||||
if not config[key] then
|
||||
config[key] = luci.model.uci.cursor():get_all("luci", key)
|
||||
end
|
||||
return config[key]
|
||||
end
|
||||
})
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
|
Loading…
Reference in a new issue