fix: add detection for Knex connection pool timeout as transient error

This commit is contained in:
Pranav C
2026-01-28 07:07:25 +00:00
parent a4615c7191
commit 1c2ea4f251
2 changed files with 9 additions and 0 deletions

View File

@@ -121,6 +121,7 @@ export function isTransientError(error: any): boolean {
'unable to connect',
'lost connection',
'connection was killed',
'timeout acquiring a connection', // Knex connection pool timeout
];
if (specificPatterns.some((pattern) => errorMessage.includes(pattern))) {

View File

@@ -307,6 +307,14 @@ function isTransientErrorTests() {
expect(isTransientError(error)).to.be.true;
});
it('should identify Knex connection pool timeout', () => {
const error = {
message:
'Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?',
};
expect(isTransientError(error)).to.be.true;
});
it('should identify network partition', () => {
const error = {
code: 'EHOSTUNREACH',