From fbc4bd0b35070a39bfd965cb9e08b434caf07a5e Mon Sep 17 00:00:00 2001 From: niemijoe Date: Wed, 17 Aug 2022 13:14:46 +0300 Subject: [PATCH] Fixed usage of IS_DEBUG --- mqtt_data_collector.py | 8 ++++---- pulsar_data_collector.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mqtt_data_collector.py b/mqtt_data_collector.py index 6971ce0..7e6c2de 100644 --- a/mqtt_data_collector.py +++ b/mqtt_data_collector.py @@ -9,10 +9,10 @@ load_dotenv() -IS_DEBUG = os.getenv('IS_DEBUG') +IS_DEBUG = os.getenv('IS_DEBUG') == "True" # How long to listen to the topics until we send data to Azure. Should be 60 in production -MONITOR_PERIOD_IN_SECONDS = 60 if IS_DEBUG == "False" else 3 +MONITOR_PERIOD_IN_SECONDS = 60 if IS_DEBUG == False else 3 def main(): """ @@ -55,10 +55,10 @@ def listen_topic_thread(topic_data_string): for i in range(len(threads)): threads[i].join() - if IS_DEBUG == "True": + if IS_DEBUG: print(topic_data_collection) else: - send_mqtt_msg_count_into_azure(topic_data_collection) + # send_mqtt_msg_count_into_azure(topic_data_collection) print(f'Mqtt metrics sent: {datetime.now().strftime("%Y-%m-%dT%H:%M:%S")}') def listen_topic(topic_data_collection, topic_data_collection_key, address, topic, port): diff --git a/pulsar_data_collector.py b/pulsar_data_collector.py index 0e19492..22cf989 100644 --- a/pulsar_data_collector.py +++ b/pulsar_data_collector.py @@ -7,7 +7,7 @@ load_dotenv() -IS_DEBUG = os.getenv('IS_DEBUG') +IS_DEBUG = os.getenv('IS_DEBUG') == "True" ADMIN_URL=os.getenv('ADMIN_URL') NAMESPACE=os.getenv('NAMESPACE') @@ -117,7 +117,7 @@ def send_pulsar_topic_metric_into_azure( custom_metric_json = json.dumps(custom_metric_object) - if IS_DEBUG == "True": + if IS_DEBUG: print(custom_metric_json) else: send_custom_metrics_request(custom_metric_json, 3)