mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
fix(db): increase connection pool size and timeout to handle concurrent verifications
This commit is contained in:
1 parent
03cb562866
commit
16ef17957d
1 file changed
+11
-11
+11
-11
@@ -4,9 +4,9 @@ import * as schema from "@shared/schema";
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
const dbUrl = process.env.DATABASE_URL;
|
||||
|
||||
console.log('🔗 Database initialization:', {
|
||||
NODE_ENV: process.env.NODE_ENV,
|
||||
isProduction,
|
||||
console.log('🔗 Database initialization:', {
|
||||
NODE_ENV: process.env.NODE_ENV,
|
||||
isProduction,
|
||||
hasDbUrl: !!dbUrl,
|
||||
dbHost: dbUrl ? new URL(dbUrl).hostname : 'none'
|
||||
});
|
||||
@@ -19,17 +19,17 @@ if (isProduction && dbUrl && (dbUrl.includes('logiflow-db') || dbUrl.includes('l
|
||||
console.log('🐳 PRODUCTION: Using standard PostgreSQL');
|
||||
const { Pool } = await import('pg');
|
||||
const { drizzle } = await import('drizzle-orm/node-postgres');
|
||||
|
||||
pool = new Pool({
|
||||
|
||||
pool = new Pool({
|
||||
connectionString: dbUrl,
|
||||
ssl: false,
|
||||
max: 10,
|
||||
max: 25, // Increased from 10 to handle concurrent verifications
|
||||
idleTimeoutMillis: 30000,
|
||||
connectionTimeoutMillis: 5000,
|
||||
connectionTimeoutMillis: 15000, // Increased from 5000 to 15000
|
||||
});
|
||||
|
||||
|
||||
db = drizzle({ client: pool, schema });
|
||||
|
||||
|
||||
// Test connection
|
||||
try {
|
||||
await pool.connect().then((client: any) => {
|
||||
@@ -45,9 +45,9 @@ if (isProduction && dbUrl && (dbUrl.includes('logiflow-db') || dbUrl.includes('l
|
||||
const { Pool, neonConfig } = await import('@neondatabase/serverless');
|
||||
const { drizzle } = await import('drizzle-orm/neon-serverless');
|
||||
const ws = await import('ws');
|
||||
|
||||
|
||||
neonConfig.webSocketConstructor = ws.default;
|
||||
|
||||
|
||||
if (dbUrl) {
|
||||
pool = new Pool({ connectionString: dbUrl });
|
||||
db = drizzle({ client: pool, schema });
|
||||
|
||||
Reference in new issue
Block a user