Skip to content

Commit

Permalink
refactor: simplify createPgPool
Browse files Browse the repository at this point in the history
Signed-off-by: Miroslav Bajtoš <[email protected]>
  • Loading branch information
bajtos committed Jan 13, 2025
1 parent fef06dd commit a14c9b9
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions db/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,13 @@ const onError = err => {
* @returns {Promise<PgPool>}
*/
export const createPgPool = async () => {
const stats = Object.assign(
new pg.Pool({
...poolConfig,
connectionString: DATABASE_URL
}),
/** @type {const} */({ db: 'stats' })
)
stats.on('error', onError)
await stats.query('SELECT 1')
return stats
const pool = new pg.Pool({
...poolConfig,
connectionString: DATABASE_URL
})
pool.on('error', onError)
await pool.query('SELECT 1')
return pool
}

/**
Expand Down

0 comments on commit a14c9b9

Please sign in to comment.