Adds time.sleep in Kafka validation loop 58/6758/1
authorBenjamin Diaz <bdiaz@whitestack.com>
Wed, 24 Oct 2018 19:52:42 +0000 (16:52 -0300)
committerBenjamin Diaz <bdiaz@whitestack.com>
Wed, 24 Oct 2018 19:52:42 +0000 (16:52 -0300)
Adds max_poll_interval_ms=900000 in KafkaConsumer

Signed-off-by: Benjamin Diaz <bdiaz@whitestack.com>
osm_mon/core/message_bus/common_consumer.py
osm_mon/core/message_bus/consumer.py

index 85e679f..3e1f745 100755 (executable)
@@ -22,6 +22,7 @@
 import json
 import logging
 import sys
+import time
 from json import JSONDecodeError
 
 import six
@@ -106,6 +107,7 @@ class CommonConsumer:
                     log.exception("Exception: ")
                     return
                 retries = retries + 1
+                time.sleep(2)
 
         log.info("Listening for messages...")
         for message in common_consumer:
index 363b9fc..7936513 100644 (file)
@@ -10,4 +10,5 @@ class Consumer(KafkaConsumer):
         super().__init__(bootstrap_servers=cfg.BROKER_URI,
                          key_deserializer=bytes.decode,
                          value_deserializer=bytes.decode,
+                         max_poll_interval_ms=900000,
                          group_id=group_id)