Skip to content

Commit

Permalink
add timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Feb 12, 2024
1 parent e25ad0a commit 8d7a326
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ruvnl_consumer_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ def fetch_data(data_url: str) -> pd.DataFrame:
Returns:
A pandas DataFrame of generation values for wind and PV
"""
r = requests.get(data_url)
try:
r = requests.get(data_url, timeout=10) # 10 seconds
except requests.exceptions.Timeout as e:
log.error("Timed out")
raise e

# Raise error if response is 4XX or 5XX
r.raise_for_status()
Expand Down

0 comments on commit 8d7a326

Please sign in to comment.