Skip to content

Commit

Permalink
change connection status to false on error
Browse files Browse the repository at this point in the history
  • Loading branch information
MCLiii committed Mar 6, 2024
1 parent be01b92 commit 9bdeeb2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Backend/core/comms.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,15 @@ def listen_udp(self, port: int):
frontend_data = d.copy()
try:
db.insert_data(d)
except exception:
except Exception as e:
print(traceback.format_exc())
continue
solar_car_connection['udp'] = True
else:
# Timeout occurred, handle as needed
solar_car_connection['udp'] = False
except Exception as e:
solar_car_connection['udp'] = False
print(f"Exception in UDP thread {e}")
continue

Expand Down Expand Up @@ -178,6 +179,7 @@ async def remote_db_fetch(self, server_url: str):
solar_car_connection['lte'] = False
break
except Exception as e:
solar_car_connection['lte'] = False
print(f"Error in the LTE thread: {e}")
continue

Expand Down

0 comments on commit 9bdeeb2

Please sign in to comment.