implement haproxy socket type from configuration#125
implement haproxy socket type from configuration#125mecampbellsoup wants to merge 1 commit intoleafo:masterfrom
Conversation
fcbfdc8 to
3c5d979
Compare
| when "luasocket" | ||
| create_luasocket! | ||
| when "haproxy" | ||
| create_luasocket("haproxy") |
There was a problem hiding this comment.
@leafo using your create_luasocket interface now instead, just using the raw core.tcp wasn't playing well with the expected socket API.
|
we are also using haproxy in lua and would love to be able to use this api! |
plus one! |
Would be helpful for us as well. |
|
Just adding comment in case it's helpful to anyone: if it's API compatible with LuaSocket then you can run Be warned, I have no idea how this will play with ssl. (This change in this patch too is unknown) |
3c5d979 to
bb3dfae
Compare
I tried using function connect_db(pg_settings)
-- Returns a pgmoon postgres object or nil on failure.
package.loaded.socket = core
local pg = pgmoon.new(pg_settings)
-- Set the timeout value (in milliseconds) for all socket operations
-- (connect, write, receive)
pg:settimeout(5000)
pg.convert_null = true -- https://github.com/leafo/pgmoon#converting-nulls
local success, err = pg:connect()However this does not seem to work. |
When the Lua HAProxy `core` object is detected, the socket class will automatically use its (non-blocking) socket type. The pattern is similar to existing auto-detection of whether pgmoon is running inside an NGINX context or not and choosing that socket type if so. http://www.arpalert.org/src/haproxy-lua-api/1.7/index.html#core.get_info
bb3dfae to
bb54268
Compare
Surprising it didn't work since the HAProxy Lua API docs specify the same constraint:
https://www.arpalert.org/src/haproxy-lua-api/2.6/index.html#Socket |
Resolves #114.
When the Lua HAProxy
coreobject is detected, the socket class willautomatically use its (non-blocking) socket type. The pattern is similar
to existing auto-detection of whether pgmoon is running inside an NGINX
context or not and choosing that socket type if so.
http://www.arpalert.org/src/haproxy-lua-api/1.7/index.html#core.get_info