summaryrefslogtreecommitdiffstats
path: root/miss_htbt_service
diff options
context:
space:
mode:
authorVijay Venkatesh Kumar <vv770d@att.com>2022-10-19 15:25:42 +0000
committerVijay Venkatesh Kumar <vv770d@att.com>2022-10-21 12:53:56 +0000
commit462cee04e5d952f544a8300dc5a0d1e297482e3f (patch)
treedf601b99ce29e197985a31ff7d55e8a83f107115 /miss_htbt_service
parente0b2b3674502611ef5dcb061c051dd6d19b0963a (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>
Diffstat (limited to 'miss_htbt_service')
-rw-r--r--miss_htbt_service/htbtworker.py11
1 files changed, 8 insertions, 3 deletions
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: