diff --git a/.readthedocs.yaml b/.readthedocs.yaml index bc990993..7561bbea 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,7 +1,7 @@ version: 2 build: - os: "ubuntu-20.04" + os: "ubuntu-24.04" tools: python: "3.10" jobs: diff --git a/CHANGELOG.md b/CHANGELOG.md index 8edd47e7..ee087130 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Drop Python 3.6 support (PR #327). +### Fixed +- Reduce idle CPU usage in `ConnectionPool` while waiting for + queued requests (PR #336). +- Bump readthedocs build os version to ubuntu-24.04 (PR #336). + Ubuntu-20.04 is no longer supported. + ## 1.2.0 - 2024-03-27 ### Added diff --git a/tarantool/connection_pool.py b/tarantool/connection_pool.py index f1e675b3..1734402a 100644 --- a/tarantool/connection_pool.py +++ b/tarantool/connection_pool.py @@ -660,8 +660,12 @@ def _request_process_loop(self, key, unit, last_refresh): """ while unit.request_processing_enabled: - if not unit.input_queue.empty(): - task = unit.input_queue.get() + try: + task = unit.input_queue.get(timeout=self.refresh_delay) + except queue.Empty: + task = None + + if task: method = getattr(Connection, task.method_name) try: resp = method(unit.conn, *task.args, **task.kwargs)