Skip to content

Commit e87d413

Browse files
author
Артем Ветошкин
committed
fix cpu overload with connection_pool
1 parent 28310fc commit e87d413

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tarantool/connection_pool.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,8 +660,12 @@ def _request_process_loop(self, key, unit, last_refresh):
660660
"""
661661

662662
while unit.request_processing_enabled:
663-
if not unit.input_queue.empty():
664-
task = unit.input_queue.get()
663+
try:
664+
task = unit.input_queue.get(timeout=self.refresh_delay)
665+
except queue.Empty:
666+
task = None
667+
668+
if task:
665669
method = getattr(Connection, task.method_name)
666670
try:
667671
resp = method(unit.conn, *task.args, **task.kwargs)

0 commit comments

Comments
 (0)