Release 1.2.2: fix load-balancing crash (wrong lua-resty-balancer module)
Every request to a host with additional load-balancing targets 500'd: targetinfo.lua required 'resty.balancer.round_robin', which does not exist in the lua-resty-balancer rock actually installed by the Dockerfile/install.sh. That rock provides resty.roundrobin instead, with a different constructor (roundrobin:new(nodes), not :new() + :reinit(nodes)). Verified end-to-end in a rebuilt image: requests to a load-balanced host now return 200 and alternate across both backend targets, with no Lua errors in the OpenResty log. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,11 @@ correspond to git tags (`vX.Y.Z`) and `nodejs/package.json`'s `version`.
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [1.2.2] - 2026-07-21
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Multi-target load balancing (added in 1.2.0) crashed every request to a load-balanced host: `ops/nginx_conf/targetinfo.lua` required a nonexistent `resty.balancer.round_robin` module. The `lua-resty-balancer` rock installed by the Dockerfile/`install.sh` doesn't provide that path — it provides `resty.roundrobin` (constructed as `roundrobin:new(nodes)`, not `:new()` + `:reinit(nodes)`). Fixed `targetinfo.lua` to use the real module and API; verified end-to-end that requests now round-robin across targets with no Lua errors.
|
||||||
|
|
||||||
## [1.2.1] - 2026-07-21
|
## [1.2.1] - 2026-07-21
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "proxy-api",
|
"name": "proxy-api",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "proxy-api",
|
"name": "proxy-api",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-free": "^7.3.0",
|
"@fortawesome/fontawesome-free": "^7.3.0",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "proxy-api",
|
"name": "proxy-api",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"author": [
|
"author": [
|
||||||
{
|
{
|
||||||
"name": "William Mantly",
|
"name": "William Mantly",
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ function M.get(ngx, domain, targetInfo)
|
|||||||
|
|
||||||
local json = require "cjson"
|
local json = require "cjson"
|
||||||
local redis = require "resty.redis"
|
local redis = require "resty.redis"
|
||||||
local round_robin = require "resty.balancer.round_robin"
|
local roundrobin = require "resty.roundrobin"
|
||||||
|
|
||||||
if not domain then
|
if not domain then
|
||||||
return nil, 499
|
return nil, 499
|
||||||
@@ -114,12 +114,11 @@ function M.get(ngx, domain, targetInfo)
|
|||||||
local cache_key = domain .. "_" .. (res["updated_on"] or "0")
|
local cache_key = domain .. "_" .. (res["updated_on"] or "0")
|
||||||
|
|
||||||
if not M.host_balancers[domain] or M.host_balancers[domain].key ~= cache_key then
|
if not M.host_balancers[domain] or M.host_balancers[domain].key ~= cache_key then
|
||||||
local b = round_robin:new()
|
|
||||||
local nodes = {}
|
local nodes = {}
|
||||||
for _, t in ipairs(target_list) do
|
for _, t in ipairs(target_list) do
|
||||||
nodes[t] = 1
|
nodes[t] = 1
|
||||||
end
|
end
|
||||||
b:reinit(nodes)
|
local b = roundrobin:new(nodes)
|
||||||
M.host_balancers[domain] = { b = b, key = cache_key }
|
M.host_balancers[domain] = { b = b, key = cache_key }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user