) { set $memcached_key $upstream_http_x_memcached_key; } access_by_lua ' while true do ngx.sleep(2); local res = ngx.location.capture("/has_memcached", { share_all_vars = true } ); if res.status == 200 then return; end if 30 < ngx.now() - ngx.req.start_time() then ngx.header.Retry_After = 60; ngx.exit(ngx.HTTP_SERVICE_UNAVAILABLE); return; end end '; memcached_pass 127.0.0.1:11211; } location /has_memcached { internal; memcached_pass 127.0.0.1:11211; }
24224) if not ok then return ngx.exit(ngx.HTTP_SERVICE_UNAVAILABLE) end -- forward ܗࣜͷϝοηʔδΛΈཱͯͯ͛Δ local bytes, err = sock:send( msgpack.pack({"access", ngx.time(), args}) ) if err then return ngx.exit(ngx.HTTP_SERVICE_UNAVAILABLE) end sock:setkeepalive(10000) -- keepalive 10 sec. -- ϨεϙϯεΛฦ͢ ngx.header.content_type = "text/plain" ngx.say("ok")