Commit 95ae1e89 by Joneq

修复日志添加以及redis链接异常自动跳转302

parent cca96a45
Showing with 6 additions and 6 deletions
...@@ -42,19 +42,19 @@ local ok, err = red:connect(config.redis_host, config.redis_port) ...@@ -42,19 +42,19 @@ local ok, err = red:connect(config.redis_host, config.redis_port)
-- 如果连接失败,跳转到label处 -- 如果连接失败,跳转到label处
if not ok then if not ok then
ngx.say("failed to connect: ", err) -- ngx.say("failed to connect: ", err) 防止reds出问题影响网络去除链接错误跳转
ngx.exit(ngx.HTTP_FORBIDDEN) -- ngx.exit(ngx.HTTP_FORBIDDEN)
return return
end end
if config.redis_auth ~= "" then if config.redis_auth ~= "" && ok then
local ok, err = red:auth(config.redis_auth) local ok, err = red:auth(config.redis_auth)
-- 如果连接失败,跳转到label处 -- 如果连接失败,跳转到label处
if not ok then if not ok then
ngx.say("failed to connect: ", err) -- ngx.say("failed to connect: ", err) 防止reds出问题影响网络去除链接错误跳转
ngx.exit(ngx.HTTP_FORBIDDEN) -- ngx.exit(ngx.HTTP_FORBIDDEN)
return return
end end
end end
...@@ -406,7 +406,7 @@ else ...@@ -406,7 +406,7 @@ else
arr['type'] = 2 arr['type'] = 2
end end
end end
red:lpush('spider_ip_info_list',cjson.encode(arr)) -- red:lpush('spider_ip_info_list',cjson.encode(arr))
--设置有效时间 --设置有效时间
res , err = red:expire(spider_time .. user_ip , spider_key_exit_time) res , err = red:expire(spider_time .. user_ip , spider_key_exit_time)
res , err = red:expire(spider_count .. user_ip , spider_key_exit_time) res , err = red:expire(spider_count .. user_ip , spider_key_exit_time)
......
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 sign in to comment