ZigzagAK/ngx_zookeeper_lua

zoo.lua will fail on line 91 if zoo.cache.path.ttl wont be specified

Closed this issue · 1 comments

https://github.com/dmajere/ngx_zookeeper_lua/blob/master/lua/zoo.lua#L91

local zoo_cache_path_ttl = json_decode(CONFIG:get("zoo.cache.path.ttl") or {})

should be

local zoo_cache_path_ttl = json_decode(CONFIG:get("zoo.cache.path.ttl") or '{}')

either way will fail with something like

2019/04/15 22:28:10 [error] 28#28: init_worker_by_lua error: /usr/local/openresty/lualib/zoo.lua:91: bad argument #1 to 'json_decode' (string expected, got table)
stack traceback:
	[C]: in function 'json_decode'
	/usr/local/openresty/lualib/zoo.lua:91: in main chunk
	[C]: in function 'require'
	init_worker_by_lua:2: in main chunk

@dmajere
Thx, fixed.