Skip to content

Commit

Permalink
BF: Endless Loop leads to TooManyRequests
Browse files Browse the repository at this point in the history
  • Loading branch information
bassmaster187 committed Sep 3, 2024
1 parent d772a21 commit 42856de
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions TeslaLogger/DBHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4468,17 +4468,24 @@ public void StartDriveState(DateTime now)
if (posID == 0)
posID = GetMaxPosid();

using (MySqlConnection con = new MySqlConnection(DBConnectionstring))
try
{
con.Open();
using (MySqlCommand cmd = new MySqlCommand("insert drivestate (StartDate, StartPos, CarID, wheel_type) values (@StartDate, @Pos, @CarID, @wheel_type)", con))
using (MySqlConnection con = new MySqlConnection(DBConnectionstring))
{
cmd.Parameters.AddWithValue("@StartDate", now);
cmd.Parameters.AddWithValue("@Pos", posID);
cmd.Parameters.AddWithValue("@CarID", car.CarInDB);
cmd.Parameters.AddWithValue("@wheel_type", car.wheel_type);
_ = SQLTracer.TraceNQ(cmd, out _);
con.Open();
using (MySqlCommand cmd = new MySqlCommand("insert drivestate (StartDate, StartPos, CarID, wheel_type) values (@StartDate, @Pos, @CarID, @wheel_type)", con))
{
cmd.Parameters.AddWithValue("@StartDate", now);
cmd.Parameters.AddWithValue("@Pos", posID);
cmd.Parameters.AddWithValue("@CarID", car.CarInDB);
cmd.Parameters.AddWithValue("@wheel_type", car.wheel_type);
_ = SQLTracer.TraceNQ(cmd, out _);
}
}
} catch (Exception ex)
{
car.Log(ex.ToString());
car.SendException2Exceptionless(ex);
}

Insert_active_route_energy_at_arrival(posID, true);
Expand Down

0 comments on commit 42856de

Please sign in to comment.