From: Steven Barth Date: Fri, 5 Dec 2008 15:36:44 +0000 (+0000) Subject: Reload luci.config for each thread X-Git-Tag: 0.9.0~924 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7540f86d40b23b04dd2de16ed90fc024d2cfa4ce;p=oweals%2Fluci.git Reload luci.config for each thread --- diff --git a/libs/web/luasrc/config.lua b/libs/web/luasrc/config.lua index 258f5e655..53db82b32 100644 --- a/libs/web/luasrc/config.lua +++ b/libs/web/luasrc/config.lua @@ -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) \ No newline at end of file + end)