-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
balancer_by_lua for streams #54
Conversation
@rshriram I think you should update |
* fix typo in build command * timeout tests for streams
@agentzh I have updated the Travis file. Temporarily it's pointing to my fork of stream lua module. I want the Travis tests to pass before fixing it. I have also temporarily disabled the timeout tests for stream module until the timeout related compilation issue can be resolved. Should this PR get accepted, when will it be available via standard OpenResty release? I would like to avoid shipping custom variants of OpenResty in my docker images. |
@rshriram Just patch the Yes, they should go into the official OpenResty distribution eventually. But before that, we should do the following:
Let's do the 1st item for now. |
t/balancer-stream.t
Outdated
upstream backend { | ||
server 0.0.0.1:80; | ||
balancer_by_lua_block { | ||
local b = require "ngx.balancer.stream" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use ngx.balancer
as the API while keeping the implementation specific to the stream subsystem in ngx.balancer.stream
. So the user require ngx.balancer
instead of ngx.balancer.stream
. This encourages Lua code reuse on the user Lua land.
One option is to sprinkle a whole bunch of if blocks across the balancer.lua to check if it's in http or stream context (how do I do this?) |
@rshriram No, you can do something like below in the top-level scope of if ngx.config.subsystem == "stream" then
return require "ngx.balancer.stream"
end Just one Also check existing test files and Lua modules in lua-resty-core for how to handle Lua module search paths and module names for |
Hi @agentzh |
This PR is the counterpart to openresty/stream-lua-nginx-module#30
Its based on @splitice's #25