Skip to content

Commit

Permalink
Add connection timeouts to broker api calls #1113
Browse files Browse the repository at this point in the history
  • Loading branch information
mher committed Jun 20, 2021
1 parent 3560865 commit d4ea1dc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions flower/utils/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def queues(self, names):
try:
response = yield http_client.fetch(
url, auth_username=username, auth_password=password,
connect_timeout=1.0, request_timeout=2.0,
validate_cert=False)
except (socket.error, httpclient.HTTPError) as e:
logger.error("RabbitMQ management API call failed: %s", e)
Expand Down
2 changes: 1 addition & 1 deletion flower/views/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get(self):
broker_use_ssl = self.capp.conf.BROKER_USE_SSL

try:
broker = Broker(app.capp.connection().as_uri(include_password=True),
broker = Broker(app.capp.connection(connect_timeout=1.0).as_uri(include_password=True),
http_api=http_api, broker_options=broker_options, broker_use_ssl=broker_use_ssl)
except NotImplementedError:
raise web.HTTPError(
Expand Down

0 comments on commit d4ea1dc

Please sign in to comment.