ledgetech / ledgetech/lua-resty-http
Connect Pool Not Work
Open
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 2.1k
- Forks
- 630
- PR merge metrics
- No merged PRs in 30d
Description
local function send_mirror_request(premature, method, url, headers, body)
local httpc = http.new()
headers['dev-mirror'] = "1"
local res, err = httpc:request_uri(url, {
version = 1.1,
method = method,
headers = headers,
body = body,
ssl_verify = false,
keepalive_timeout = 65000,
keepalive = true,
keepalive_pool = 200,
})
if not res then
ngx.log(ngx.ERR, "Failed to mirror request: ", err)
return
end
ngx.log(ngx.DEBUG, "response connection:" ..res.headers["Connection"])
local ok, err = httpc:set_keepalive(65000, 200)
if not ok then
ngx.log(ngx.ERR, "failed to set keepalive: ", err)
return
end
end
local ok, err = ngx.timer.at(0, send_mirror_request, ngx.var.request_method, mirror_url, headers, body_data)
if not ok then
ngx.log(ngx.ERR, "Failed to create timer: ", err)
end
recieve log info
[debug] 5868#0: *2873067271 [lua] response connection:keep-alive
[error] 5868#0: *2873067271 [lua] failed to set keepalive: closed, context: ngx.timer
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided send_mirror_request callback and its ngx.timer.at entry point, then inspect the request_uri and set_keepalive calls around the reported "closed" error. Reproduce the timer-context failure and determine the expected connection-pool behavior; done means the documented request path no longer reports an unexpected keepalive failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100