{"action":"opened","issue":{"url":"https://api.github.com/repos/openresty/lua-resty-redis/issues/78","repository_url":"https://api.github.com/repos/openresty/lua-resty-redis","labels_url":"https://api.github.com/repos/openresty/lua-resty-redis/issues/78/labels{/name}","comments_url":"https://api.github.com/repos/openresty/lua-resty-redis/issues/78/comments","events_url":"https://api.github.com/repos/openresty/lua-resty-redis/issues/78/events","html_url":"https://github.com/openresty/lua-resty-redis/issues/78","id":140857420,"number":78,"title":"failed to set keepalive: connection in dubious state","user":{"login":"hcaihao","id":3926845,"avatar_url":"https://avatars.githubusercontent.com/u/3926845?v=3","gravatar_id":"","url":"https://api.github.com/users/hcaihao","html_url":"https://github.com/hcaihao","followers_url":"https://api.github.com/users/hcaihao/followers","following_url":"https://api.github.com/users/hcaihao/following{/other_user}","gists_url":"https://api.github.com/users/hcaihao/gists{/gist_id}","starred_url":"https://api.github.com/users/hcaihao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hcaihao/subscriptions","organizations_url":"https://api.github.com/users/hcaihao/orgs","repos_url":"https://api.github.com/users/hcaihao/repos","events_url":"https://api.github.com/users/hcaihao/events{/privacy}","received_events_url":"https://api.github.com/users/hcaihao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-15T02:59:48Z","updated_at":"2016-03-15T02:59:48Z","closed_at":null,"body":"local redis = require \"resty.redis\"\r\nlocal red = redis:new()\r\n\r\nred:set_timeout(1000) -- 1 sec\r\n\r\nlocal ok, err = red:connect(\"127.0.0.1\", 6379)\r\nif not ok then\r\n    ngx.say(\"failed to connect: \", err)\r\n    return\r\nend\r\n\r\n--ngx.say(\"connected to redis.\")\r\n\r\n\r\nlocal key = \"testkey\"\r\nred:set(key, false)\r\n\r\nlocal ok, err = red:set_keepalive(10000, 100)\r\nif not ok then\r\n\tngx.say(\"failed to set keepalive: \", err)\r\n\treturn\r\nend\r\n\r\n\r\nThe code bellow will throw an error: \"failed to set keepalive: connection in dubious state\"\r\n\r\n\r\nBut \"red:set(key, true)\" will be ok, why?"}}