Authored by LUOXC

去掉ip+method限流

@@ -102,25 +102,7 @@ function rate_limit() @@ -102,25 +102,7 @@ function rate_limit()
102 ngx.exit(ngx.HTTP_OK) 102 ngx.exit(ngx.HTTP_OK)
103 end 103 end
104 104
105 - -- do limit by ip+method, max qps is [max_per_sencond / 10]  
106 - local ip = ngx.var.real_ip  
107 - if not ip then  
108 - return  
109 - end  
110 - local key = ip .. ":" .. req_uri_method  
111 - local max_qps_ip = max_per_sencond / 10  
112 - if max_qps_ip <= default_minimal_ip_method_qps then  
113 - max_qps_ip = default_minimal_ip_method_qps  
114 - end  
115 - local ret = limit("yh:ngx:limitIP:" .. key, max_qps_ip)  
116 - if not ret then  
117 - ngx.header["Content-Type"]="application/json;charset=utf-8"  
118 - local rsp_body = '{"code":' .. err_code .. ',"message":"'.. err_msg .. '"}'  
119 - ngx.say(rsp_body)  
120 - ngx.exit(ngx.HTTP_OK)  
121 - end  
122 -  
123 - 105 +
124 106
125 end 107 end
126 108