From: Vladimír Čunát Date: Mon, 14 Jan 2019 15:44:56 +0000 (+0100) Subject: modules/predict: don't skip reconfiguration if nil is passed X-Git-Tag: v4.0.0~50^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=548881ec14f79a547df67d800e4d67a73de0c2d5;p=thirdparty%2Fknot-resolver.git modules/predict: don't skip reconfiguration if nil is passed If you didn't specify any configuration (i.e. nil), the stats module wouldn't get loaded even though the defaults need it to work. Now we don't skip that part and pass whole .config() even on nil config. --- diff --git a/NEWS b/NEWS index d54bb03ba..823b5ea89 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +Knot Resolver 3.x.y (2019-0m-dd) +================================ + +Bugfixes +-------- +- predict module: load stats module if config didn't specify period (!755) + + Knot Resolver 3.2.1 (2019-01-10) ================================ diff --git a/modules/predict/predict.lua b/modules/predict/predict.lua index 846d4ef7d..470700f3b 100644 --- a/modules/predict/predict.lua +++ b/modules/predict/predict.lua @@ -158,7 +158,10 @@ end function predict.config(config) -- Reconfigure - if type(config) ~= 'table' then return end + config = config or {} + if type(config) ~= 'table' then + error('[predict] configuration must be a table or nil') + end if config.window then predict.window = config.window end if config.period then predict.period = config.period end -- Load dependent modules diff --git a/modules/predict/tests/predict.test.lua b/modules/predict/tests/predict.test.lua index 10431045e..3d7c7f7d2 100644 --- a/modules/predict/tests/predict.test.lua +++ b/modules/predict/tests/predict.test.lua @@ -1,5 +1,5 @@ -- setup resolver -modules = { 'predict', 'stats' } +modules = { 'predict' } -- mock global functions local resolve_count = 0