forked from typeorm/typeorm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove bad connections from the postgres pool after a failed query
typeorm currently lets pg.pool assume that clients are always safe to add back into the pool, even if it encountered an error while running a query. this is /usually/ fine, because the vast majority of errors that happen during a query do not cause the client's connection itself to become inoperable however, if, during a query, the client's connection is killed, the query will fail and the client will be placed back into the pool even though it's linked to a now broken connection, i.e. that client will never work again, but because pg.Pool doesn't know that, it'll keep handing it out. end result: lots of failed queries this patches `Connection.prototype.query` so that it passes the error back to the driver when it calls `queryRunner.release`. the driver can (if applicable) then inspect the error and decide if it should result in the client being removed from the pool or just released as normal
- Loading branch information
Showing
3 changed files
with
27 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters