Skip to content

Commit 12e5e01

Browse files
committed
Update logic
1 parent 2151737 commit 12e5e01

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

plugin.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,20 @@ function executionScope (pool, fn, cb) {
77
pool.getConnection(function (err, conn) {
88
if (err) return cb(err)
99

10-
const release = (conn) => {
11-
conn.close(function (_) {
12-
})
13-
}
14-
1510
const commit = (err, res) => {
1611
if (err) {
17-
release(conn)
18-
return cb(err)
12+
return conn.close(function () {
13+
return cb(err)
14+
})
1915
}
2016

2117
conn.commit(function (err) {
22-
release(conn)
23-
24-
if (err) {
25-
return cb(err)
26-
}
27-
28-
return cb(null, res)
18+
conn.close(function () {
19+
if (err) {
20+
return cb(err)
21+
}
22+
return cb(null, res)
23+
})
2924
})
3025
}
3126

test/plugin.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ test('execution scope with promise', (t) => {
133133
t.strictDeepEqual(res.rows, [ { DUMMY: 'X' } ])
134134

135135
fastify.close(err => {
136-
console.log(fastify.oracle.pool)
137136
t.error(err)
138137
t.is(fastify.oracle.pool.status, fastify.oracle.db.POOL_STATUS_CLOSED)
139138
})

0 commit comments

Comments
 (0)