close pool connections
parent
9d6346388f
commit
82c7f047cf
|
|
@ -1,6 +1,10 @@
|
|||
import { Pool } from 'better-sqlite-pool';
|
||||
import { lotOccupancyDB as databasePath } from '../../data/databasePaths.js';
|
||||
import exitHook from 'exit-hook';
|
||||
const pool = new Pool(databasePath);
|
||||
export async function acquireConnection() {
|
||||
return await pool.acquire();
|
||||
}
|
||||
exitHook(() => {
|
||||
pool.close();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,8 +2,14 @@ import { Pool, PoolConnection } from 'better-sqlite-pool'
|
|||
|
||||
import { lotOccupancyDB as databasePath } from '../../data/databasePaths.js'
|
||||
|
||||
import exitHook from 'exit-hook'
|
||||
|
||||
const pool = new Pool(databasePath)
|
||||
|
||||
export async function acquireConnection(): Promise<PoolConnection> {
|
||||
return await pool.acquire()
|
||||
}
|
||||
|
||||
exitHook(() => {
|
||||
pool.close()
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue