]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Default number of pool workers bumped to 3
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 20 Feb 2021 03:31:02 +0000 (04:31 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 12 Mar 2021 04:07:25 +0000 (05:07 +0100)
psycopg3/psycopg3/pool.py
tests/test_pool.py

index b9de95e41d23609cb50554b21988fb125681ba4f..4f2d0c0dfef674816fe97f98a05449dca1810beb 100644 (file)
@@ -45,7 +45,7 @@ class ConnectionPool:
         name: Optional[str] = None,
         timeout_sec: float = 30.0,
         max_idle_sec: float = 10 * 60.0,
-        num_workers: int = 1,
+        num_workers: int = 3,
     ):
         if maxconn is None:
             maxconn = minconn
index 8e48ad74ebcd48903bf7dccee4c96442030b6c88..0a40c6afa4653894c18890b5f56cd0f5af44e15b 100644 (file)
@@ -10,10 +10,15 @@ from psycopg3 import pool
 from psycopg3.pq import TransactionStatus
 
 
-def test_minconn_maxconn(dsn):
+def test_defaults(dsn):
     p = pool.ConnectionPool(dsn)
     assert p.minconn == p.maxconn == 4
+    assert p.timeout_sec == 30
+    assert p.max_idle_sec == 600
+    assert p.num_workers == 3
 
+
+def test_minconn_maxconn(dsn):
     p = pool.ConnectionPool(dsn, minconn=2)
     assert p.minconn == p.maxconn == 2
 
@@ -390,11 +395,6 @@ def test_grow(dsn, monkeypatch):
         assert got == pytest.approx(want, 0.15), times
 
 
-def test_default_max_idle_sec(dsn):
-    p = pool.ConnectionPool(dsn)
-    assert p.max_idle_sec == 600
-
-
 @pytest.mark.slow
 def test_shrink(dsn, monkeypatch):
     p = pool.ConnectionPool(