fix: increase idle timeout for database connection pools to 1 hour
Deploy Application / deploy (push) Successful in 38s Details

This commit is contained in:
faisolavolut 2025-11-11 14:09:38 +07:00
parent f4d8cb1031
commit a19933a06e
2 changed files with 9 additions and 2 deletions

View File

@ -96,7 +96,14 @@ export default class SyncController {
for (const database of databases) { for (const database of databases) {
const pool = await getPoolForDbId(database.db_id); const pool = await getPoolForDbId(database.db_id);
const q = "SELECT * FROM rv_openitem"; 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 rows = result.rows || [];
const freshDB = await db.rv_openitem.count({ const freshDB = await db.rv_openitem.count({
where: { db_id: database.db_id }, where: { db_id: database.db_id },

View File

@ -56,7 +56,7 @@ export async function getPoolForDbId(db_id: string) {
const pool = new Pool({ const pool = new Pool({
connectionString: connString, connectionString: connString,
max: 10, max: 10,
idleTimeoutMillis: 30000, idleTimeoutMillis: 3600000,
}); });
return pool; return pool;
} }