Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos committed Oct 31, 2023
1 parent 2ade553 commit 1cf35f1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions lib/src/pool/pool_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ class PoolImplementation<L> implements Pool<L> {
// flag is set, otherwise race conditions may create conflicts or
// pool close may miss the connection.
_connections.add(newc);
print(_connections.length);
return newc;
}
}
Expand Down Expand Up @@ -230,13 +229,13 @@ class _PoolConnection implements Connection {

bool _isExpired() {
final age = DateTime.now().difference(_opened);
if (age > _pool._settings.maxConnectionAge) {
if (age >= _pool._settings.maxConnectionAge) {
return true;
}
if (_elapsedInUse > _pool._settings.maxSessionUse) {
if (_elapsedInUse >= _pool._settings.maxSessionUse) {
return true;
}
if (_queryCount > _pool._settings.maxQueryCount) {
if (_queryCount >= _pool._settings.maxQueryCount) {
return true;
}
return false;
Expand Down
6 changes: 3 additions & 3 deletions lib/src/v3/connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,12 @@ class PgConnectionImplementation extends _PgSessionBase implements Connection {
// transaction and should be reporte to the user.
_TransactionSession? _activeTransaction;

final Map<String, String> _parameters = {};
final _parameters = <String, String>{};

var _statementCounter = 0;
var _portalCounter = 0;

late final _Channels _channels = _Channels(this);
late final _channels = _Channels(this);

@override
Channels get channels => _channels;
Expand Down Expand Up @@ -364,7 +364,7 @@ class PgConnectionImplementation extends _PgSessionBase implements Connection {
// Unlike runTx, this doesn't need any locks. An active transaction changes
// the state of the connection, this method does not. If methods requiring
// locks are called by [fn], these methods will aquire locks as needed.
return Future.sync(() => fn(session));
return Future<R>(() => fn(session));
}

@override
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: postgres
description: PostgreSQL database driver. Supports statement reuse and binary protocol and connection pooling.
version: 3.0.0-beta.1
version: 3.0.0-rc.1
homepage: https://github.com/isoos/postgresql-dart
topics:
- sql
Expand Down

0 comments on commit 1cf35f1

Please sign in to comment.