Adds params field to BlockingConnection object
It is needed for pika_pool library which expects that connections has params attribute defined in BaseConnection but BlockingConnection is not derived from BaseConnection and doesn't have it Change-Id: Ic86c4c4e929c53c116e73242b5f71aa1ec7d3d07
This commit is contained in:
@@ -311,6 +311,13 @@ class PikaEngine(object):
|
|||||||
:return: New connection
|
:return: New connection
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
connection_params = pika.ConnectionParameters(
|
||||||
|
heartbeat_interval=(
|
||||||
|
self._heartbeat_interval if for_listening else None
|
||||||
|
),
|
||||||
|
**self._connection_host_param_list[host_index]
|
||||||
|
)
|
||||||
|
|
||||||
with self._connection_lock:
|
with self._connection_lock:
|
||||||
cur_time = time.time()
|
cur_time = time.time()
|
||||||
|
|
||||||
@@ -333,20 +340,18 @@ class PikaEngine(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
base_host_params = self._connection_host_param_list[host_index]
|
|
||||||
|
|
||||||
connection = pika.BlockingConnection(
|
connection = pika.BlockingConnection(
|
||||||
parameters=pika.ConnectionParameters(
|
parameters=connection_params,
|
||||||
heartbeat_interval=(
|
|
||||||
self._heartbeat_interval
|
|
||||||
if for_listening else None
|
|
||||||
),
|
|
||||||
**base_host_params
|
|
||||||
),
|
|
||||||
_impl_class=(_create_select_poller_connection_impl
|
_impl_class=(_create_select_poller_connection_impl
|
||||||
if self._force_select_poller_use else None)
|
if self._force_select_poller_use else None)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# It is needed for pika_pool library which expects that
|
||||||
|
# connections has params attribute defined in BaseConnection
|
||||||
|
# but BlockingConnection is not derived from BaseConnection
|
||||||
|
# and doesn't have it
|
||||||
|
connection.params = connection_params
|
||||||
|
|
||||||
self._set_tcp_user_timeout(connection._impl.socket)
|
self._set_tcp_user_timeout(connection._impl.socket)
|
||||||
|
|
||||||
self._connection_host_status_list[host_index][
|
self._connection_host_status_list[host_index][
|
||||||
|
|||||||
Reference in New Issue
Block a user