Commit d2a7b2a3 authored by Marek Vavruša's avatar Marek Vavruša

modules/ketcd: added polling

parent 3fcc86cb
......@@ -39,11 +39,17 @@ function ketcd.config(conf)
if type(conf) == 'table' then
for k,v in pairs(conf) do options[k] = v end
end
-- create connection
local cli, err = ketcd.Etcd.new(options)
if err then
error(err)
end
ketcd.cli = cli
-- schedule recurrent polling
-- @todo: the etcd has watch() API, but this requires
-- coroutines on socket operations
if ketcd.ev then event.cancel(ketcd.ev) end
ketcd.ev = event.recurrent(5 * sec, ketcd.reload)
end
return ketcd
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment