Skip to content

Commit 31df6ab

Browse files
Don't select closed/closing connections in the pool (#417)
1 parent 1d2167d commit 31df6ab

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 3.5.3
44

55
- New typed exceptions: `UniqueViolationException`, `ForeignKeyViolationException`. [#416](https://github.com/isoos/postgresql-dart/pull/416) by [hurrba](https://github.com/hurrba)
6+
- Fix: don't reuse pool connections that are closed/closing. [#417](https://github.com/isoos/postgresql-dart/pull/417) by [davidmartos96](https://github.com/davidmartos96)
67

78
## 3.5.2
89

lib/src/pool/pool_impl.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ class _PoolConnection implements Connection {
232232
this._pool, this._endpoint, this._connectionSettings, this._connection);
233233

234234
bool _mayReuse(Endpoint endpoint, ResolvedConnectionSettings settings) {
235-
if (_isInUse || endpoint != _endpoint || _isExpired()) {
235+
if (_isInUse || endpoint != _endpoint || _isExpired() || !isOpen) {
236236
return false;
237237
}
238238
if (!_connectionSettings.isMatchingConnection(settings)) {

0 commit comments

Comments
 (0)