Skip to content

Commit

Permalink
Fixed usage of IS_DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
niemijoe committed Aug 17, 2022
1 parent e54a4d5 commit fbc4bd0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions mqtt_data_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
"""
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions pulsar_data_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit fbc4bd0

Please sign in to comment.