https://sonarly.com/issue/36017?type=bug
Background worker's PostgreSQL connection becomes stale during 30+ second Gmail API batch fetch operations, causing "Connection terminated unexpectedly" when subsequent database queries execute.
Fix: **Fix: Enable TCP keepalives on PostgreSQL connections**
Added TCP keepalive settings to all database connection configurations:
- `keepAlive: true` - enables TCP keepalive probes
- `keepAliveInitialDelayMillis: 10000` - sends first probe after 10 seconds of idle time
This prevents AWS load balancers/RDS proxy from terminating idle connections during long-running external API operations (like Gmail batch fetches that take 30+ seconds).
Files changed for the fix:
1. `global-workspace-datasource.service.ts` - primary and replica datasource configurations
2. `core.datasource.ts` - core datasource configuration
Both locations now have consistent keepalive settings that will maintain TCP connections through infrastructure idle timeouts.