Skip to content

Commit abaad1e

Browse files
committed
refactoring: cleanup code
Justification for code cleanup: * To make the code easier to understand, the variable is declared inside the scope where it will be used. * Remove unnecessary recheck.
1 parent 8319410 commit abaad1e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

mysql/init.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ local function conn_get(pool, timeout)
3535
-- A timeout was reached.
3636
if mysql_conn == nil then return nil end
3737

38-
local status
3938
if mysql_conn == POOL_EMPTY_SLOT then
39+
local status
4040
status, mysql_conn = driver.connect(pool.host, pool.port or 0,
4141
pool.user, pool.pass,
4242
pool.db, pool.use_numeric_result)
@@ -163,9 +163,7 @@ local function pool_create(opts)
163163
local mysql_conn = queue:get()
164164
mysql_conn:close()
165165
end
166-
if status < 0 then
167-
error(conn)
168-
end
166+
error(conn)
169167
end
170168
queue:put(conn)
171169
end

0 commit comments

Comments
 (0)