diff options
author | Vijay Venkatesh Kumar <vv770d@att.com> | 2022-10-19 15:25:42 +0000 |
---|---|---|
committer | Vijay Venkatesh Kumar <vv770d@att.com> | 2022-10-21 12:53:56 +0000 |
commit | 462cee04e5d952f544a8300dc5a0d1e297482e3f (patch) | |
tree | df601b99ce29e197985a31ff7d55e8a83f107115 | |
parent | e0b2b3674502611ef5dcb061c051dd6d19b0963a (diff) |
Handle MR connection error
Change-Id: I8defdd65093d19d4255427a8c7961cf5249007b8
Signed-off-by: Vijay Venkatesh Kumar <vv770d@att.com>
Issue-ID: DCAEGEN2-2952
Signed-off-by: Vijay Venkatesh Kumar <vv770d@att.com>
-rw-r--r-- | Changelog.md | 3 | ||||
-rw-r--r-- | miss_htbt_service/htbtworker.py | 11 | ||||
-rw-r--r-- | pom.xml | 2 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | version.properties | 4 |
5 files changed, 15 insertions, 7 deletions
diff --git a/Changelog.md b/Changelog.md index f58fc8c..4631560 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [2.5.0] - 2022/10/19 +- [DCAEGEN2-2952] Handle exception when MR is unavailable + ## [2.4.1] - 2022/09/23 - [DCAEGEN2-2837] Heartbeat ms: remove unnecessary parenthesis, use lowercase variable name - [DCAEGEN2-3268] Fix cryptography version to 37.0.4 diff --git a/miss_htbt_service/htbtworker.py b/miss_htbt_service/htbtworker.py index ac7a0d9..0d43533 100644 --- a/miss_htbt_service/htbtworker.py +++ b/miss_htbt_service/htbtworker.py @@ -98,9 +98,14 @@ def process_msg(jsfile, user_name, password, ip_address, port_num, db_name): i = 0 break else: - res = requests.get(get_url) - msg = "HBT:", res.text - _logger.info(msg) + try: + res = requests.get(get_url) + except Exception as e: + # message-router may be down temporarily. continue polling loop to try again + _logger.error('HBT: Failed to fetch messages from DMaaP. get_url=%s', get_url, exc_info=e) + time.sleep(1) + continue + _logger.info("HBT: %s", res.text) input_string = res.text # If mrstatus in message body indicates some information, not json msg. if "mrstatus" in input_string: @@ -37,7 +37,7 @@ limitations under the License. <groupId>org.onap.dcaegen2.services</groupId> <artifactId>heartbeat</artifactId> <name>dcaegen2-services-heartbeat</name> - <version>2.4.1</version> + <version>2.5.0</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <sonar.sources>.</sonar.sources> @@ -20,7 +20,7 @@ from setuptools import setup, find_packages setup( name="miss_htbt_service", description="Missing heartbeat microservice to communicate with policy-engine", - version="2.4.1", + version="2.5.0", # packages=find_packages(exclude=["tests.*", "tests"]), packages=find_packages(), install_requires=[ diff --git a/version.properties b/version.properties index a88b650..6c69733 100644 --- a/version.properties +++ b/version.properties @@ -1,6 +1,6 @@ major=2 -minor=4 -patch=1 +minor=5 +patch=0 base_version=${major}.${minor}.${patch} release_version=${base_version} snapshot_version=${base_version}-SNAPSHOT |