Skip to content

Handle connection error in pool:get() #48

Open
@Totktonada

Description

@Totktonada

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions