Skip to content

Commit

Permalink
fix: use mysql pool instead of connection
Browse files Browse the repository at this point in the history
#116
Signed-off-by: Jytesh <44925963+Jytesh@users.noreply.github.com>
  • Loading branch information
Jytesh committed Jun 20, 2022
1 parent 8dff30c commit 0f87178
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/mysql/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ class KeyvMysql extends KeyvSql {
uri,
options
)

const pool = mysql.createPool(options.uri)
options.connect = () =>
Promise.resolve()
.then(() => mysql.createConnection(options.uri))
.then(connection => {
return sql => connection.execute(sql).then(data => data[0])
.then(() => {
return sql => pool.execute(sql).then(data => data[0])
})

super(options)
Expand Down

0 comments on commit 0f87178

Please sign in to comment.