Skip to content

Handle connection error in pool:get() #48

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

Open
Totktonada opened this issue Sep 28, 2020 · 0 comments
Open

Handle connection error in pool:get() #48

Totktonada opened this issue Sep 28, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@Totktonada
Copy link
Member

See the code:

mysql/mysql/init.lua

Lines 31 to 46 in 9ca113b

-- get connection from pool
local function conn_get(pool, timeout)
local mysql_conn = pool.queue:get(timeout)
-- A timeout was reached.
if mysql_conn == nil then return nil end
local status
if mysql_conn == POOL_EMPTY_SLOT then
status, mysql_conn = driver.connect(pool.host, pool.port or 0,
pool.user, pool.pass,
pool.db, pool.use_numeric_result)
if status < 0 then
return error(mysql_conn)
end
end

When we got POOL_EMPTY_SLOT from the pool and a connection error occurs, we don't return the slot back to the pool.

@Totktonada Totktonada added the bug Something isn't working label Sep 28, 2020
@Totktonada Totktonada added backlog Issues for upcoming releases (to be done soon) prio4 teamE labels Dec 21, 2020
@kyukhin kyukhin removed backlog Issues for upcoming releases (to be done soon) prio4 labels Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants