Skip to content

Commit

Permalink
Increase MQTT keep alive to 5s
Browse files Browse the repository at this point in the history
  • Loading branch information
mjaakko committed Dec 2, 2022
1 parent b0ce39c commit 44f26c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mqtt_data_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# MQTT keep alive interval
# This needs to be small enough to detect if the connection is down so that message rate will be calculated correctly
MQTT_KEEP_ALIVE_SECS = 1
MQTT_KEEP_ALIVE_SECS = 5

IS_DEBUG = os.getenv('IS_DEBUG') == "True"

Expand Down Expand Up @@ -100,7 +100,7 @@ def get_msg_count(self):
elapsed_time = self.measuring_stopped_at - self.measuring_started_at

# If data was collected for too short period, we can't accurately calculate the message rate
if elapsed_time < 10*MQTT_KEEP_ALIVE_SECS:
if elapsed_time < min(25, 10*MQTT_KEEP_ALIVE_SECS):
# Return None if elapsed_time is too small to calculate accurate result
return None

Expand Down

0 comments on commit 44f26c1

Please sign in to comment.