I want to watch etcd value change, so I wrote some codes to test coroutine
http {
include mime.types;
lua_shared_dict routeIndicator 1m;
default_type application/octet-stream;
init_by_lua '
local routeIndicator = ngx.shared.routeIndicator;
co=coroutine.create(function ()
local index=0
while(true)
do
local routeIndicator = ngx.shared.routeIndicator;
index=index+1
routeIndicator:set("index", index)
ngx.sleep(5)
end
end)
coroutine.resume(co)
';
I found nothing happened? any idea