]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Provide public accessor for Pool.timeout().
authorIrina Delamare <irina.delamare@gmail.com>
Thu, 24 Jan 2019 00:23:59 +0000 (19:23 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 24 Jan 2019 17:45:06 +0000 (12:45 -0500)
Added public accessor :meth:`.Pool.timeout` that returns the configured
timeout for a :class:`.Pool` object.  Pull request courtesy Irina Delamare.

Fixes: #3689
Closes: #4447
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4447
Pull-request-sha: 0179b0a829e9609429dc698992670d2e6749c10c

Change-Id: I402b065cf9183160f71d9de73e308268356b7deb

doc/build/changelog/unreleased_13/3689.rst [new file with mode: 0644]
lib/sqlalchemy/pool/impl.py
test/engine/test_pool.py

diff --git a/doc/build/changelog/unreleased_13/3689.rst b/doc/build/changelog/unreleased_13/3689.rst
new file mode 100644 (file)
index 0000000..80ab78d
--- /dev/null
@@ -0,0 +1,6 @@
+.. change::
+   :tags: feature, engine
+   :tickets: 3689
+
+   Added public accessor :meth:`.Pool.timeout` that returns the configured
+   timeout for a :class:`.Pool` object.  Pull request courtesy Irina Delamare.
index ebbbfdb3d0315e9c47322c82d01cd3b43e99d655..e1b948625aa1a625b5d54641c82ea128ab090bc5 100644 (file)
@@ -201,6 +201,9 @@ class QueuePool(Pool):
     def size(self):
         return self._pool.maxsize
 
+    def timeout(self):
+        return self._timeout
+
     def checkedin(self):
         return self._pool.qsize()
 
index 75caa233afd0191175a4bd8e2118de83967d861e..672942482a7d1a8fa42b008f10fca07cbed08288 100644 (file)
@@ -1130,6 +1130,12 @@ class QueuePoolTest(PoolTestBase):
         lazy_gc()
         assert not pool._refs
 
+    def test_timeout_accessor(self):
+        expected_timeout = 123
+        p = self._queuepool_fixture(
+            timeout=expected_timeout)
+        eq_(p.timeout(), expected_timeout)
+
     @testing.requires.timing_intensive
     def test_timeout(self):
         p = self._queuepool_fixture(pool_size=3, max_overflow=0, timeout=2)