Skip to content

Commit ae18e6b

Browse files
authored
Merge pull request #79 from hatertron3000/patch-1
Implement mysql connection pooling
2 parents 7d3db8f + 0b5a944 commit ae18e6b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/dbs/mysql.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ const MYSQL_CONFIG = {
1111
};
1212

1313
// For use with Heroku ClearDB
14-
// Other mysql: https://www.npmjs.com/package/mysql#establishing-connections
15-
const connection = mysql.createConnection(process.env.CLEARDB_DATABASE_URL ? process.env.CLEARDB_DATABASE_URL : MYSQL_CONFIG);
16-
const query = promisify(connection.query.bind(connection));
14+
// Other mysql: https://www.npmjs.com/package/mysql#pooling-connections
15+
const pool = mysql.createPool(process.env.CLEARDB_DATABASE_URL ? process.env.CLEARDB_DATABASE_URL : MYSQL_CONFIG);
16+
const query = promisify(pool.query.bind(pool));
1717

1818
// Use setUser for storing global user data (persists between installs)
1919
export async function setUser({ user }: SessionProps) {

0 commit comments

Comments
 (0)