Skip to content

Commit

Permalink
add timeout exception error and timeout vals
Browse files Browse the repository at this point in the history
  • Loading branch information
sanahabhimani committed Nov 28, 2023
1 parent c78e6f4 commit 73e726e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions socs/agents/ucsc_radiometer/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,16 @@ def acq(self, session, params=None):

while self.take_data:
try:
r = requests.get(self.url)
r = requests.get(self.url, timeout=6)
except ValueError:
pm.sleep()
continue
except requests.exceptions.ConnectionError:
self.log.warn("Unable to connect to radiometer server. Connection closed. Trying again..")
except requests.exceptions.ConnectionError as e:
self.log.warn(f"Connection error occured: {e}")
pm.sleep()
continue
except requests.exceptions.Timeout as e:
self.log.warn(f"Timeout exception occurred: {e}")
pm.sleep()
continue
data = r.json()
Expand Down

0 comments on commit 73e726e

Please sign in to comment.