From b2b9ecdd614d228e94dec988ae13a8c40cf6f53d Mon Sep 17 00:00:00 2001 From: Stanislav Vodetskyi <49661990+stan-confluent@users.noreply.github.com> Date: Thu, 1 Dec 2022 01:46:45 -0800 Subject: [PATCH] MINOR: try-finally around super call in http.py (#12924) Reviewers: Daniel Gospodinow , Ian McDonald , Manikumar Reddy --- tests/kafkatest/services/monitor/http.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/kafkatest/services/monitor/http.py b/tests/kafkatest/services/monitor/http.py index ef74a5e1ac7..aa564fd47c6 100644 --- a/tests/kafkatest/services/monitor/http.py +++ b/tests/kafkatest/services/monitor/http.py @@ -94,13 +94,14 @@ class HttpMetricsCollector(object): super(HttpMetricsCollector, self).start_node(node) def stop(self): - super(HttpMetricsCollector, self).stop() - - if self._http_metrics_thread: - self.logger.debug("Shutting down metrics httpd") - self._httpd.shutdown() - self._http_metrics_thread.join() - self.logger.debug("Finished shutting down metrics httpd") + try: + super(HttpMetricsCollector, self).stop() + finally: + if self._http_metrics_thread: + self.logger.debug("Shutting down metrics httpd") + self._httpd.shutdown() + self._http_metrics_thread.join() + self.logger.debug("Finished shutting down metrics httpd") def stop_node(self, node): super(HttpMetricsCollector, self).stop_node(node)