Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Commit

Permalink
increase the give up threshold to 30 minutes to cover two fast poll i…
Browse files Browse the repository at this point in the history
…ntervals
  • Loading branch information
mjmeli committed Jan 6, 2023
1 parent c510234 commit 4a033b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = pyduke-energy
version = 1.0.3
version = 1.0.4
author = Michael Meli
author_email = [email protected]
description = Python Wrapper for unofficial Duke Energy REST API
Expand Down
9 changes: 6 additions & 3 deletions src/pyduke_energy/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,20 @@
MQTT_ENDPOINT = "/app-mqtt"
MQTT_KEEPALIVE = 50 # Seconds, it appears the server will disconnect after 60s idle

# in minutes, how long a fastpoll interval is
FASTPOLL_TIMEOUT_MIN = 15

# in seconds, how long to until the fastpoll request has timed out and a new one needs to be made
FASTPOLL_TIMEOUT_SEC = 900 - 3 # seconds
FASTPOLL_TIMEOUT_SEC = (FASTPOLL_TIMEOUT_MIN * 60) - 3 # seconds

# in seconds, how long to wait for a message before retrying fastpoll or reconnecting
MESSAGE_TIMEOUT_SEC = 60

# number of times a message timeout can occur before just reconnecting
MESSAGE_TIMEOUT_RETRY_COUNT = 3

# number of times a message timeout can occur before we totally give up
MESSAGE_TIMEOUT_GIVE_UP_COUNT = 10
# number of times a message timeout can occur before we totally give up (allow 2 fastpolls)
MESSAGE_TIMEOUT_GIVE_UP_COUNT = ((FASTPOLL_TIMEOUT_MIN * 60) / MESSAGE_TIMEOUT_SEC) + 1

# in minutes, minimum amount of time to wait before retrying connection on forever loop
FOREVER_RETRY_MIN_MINUTES = 1
Expand Down

0 comments on commit 4a033b0

Please sign in to comment.