fix: increase idle timeout for database connection pools to 1 hour
Deploy Application / deploy (push) Successful in 38s
Details
Deploy Application / deploy (push) Successful in 38s
Details
This commit is contained in:
parent
f4d8cb1031
commit
a19933a06e
|
|
@ -96,7 +96,14 @@ export default class SyncController {
|
|||
for (const database of databases) {
|
||||
const pool = await getPoolForDbId(database.db_id);
|
||||
const q = "SELECT * FROM rv_openitem";
|
||||
const result = await pool.query(q);
|
||||
// Set timeout to 1 hour for sync operations
|
||||
const client = await pool.connect();
|
||||
let result;
|
||||
try {
|
||||
result = await client.query(q);
|
||||
} finally {
|
||||
client.release();
|
||||
}
|
||||
const rows = result.rows || [];
|
||||
const freshDB = await db.rv_openitem.count({
|
||||
where: { db_id: database.db_id },
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ export async function getPoolForDbId(db_id: string) {
|
|||
const pool = new Pool({
|
||||
connectionString: connString,
|
||||
max: 10,
|
||||
idleTimeoutMillis: 30000,
|
||||
idleTimeoutMillis: 3600000,
|
||||
});
|
||||
return pool;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue