Skip to content

Commit

Permalink
Remove redundant check
Browse files Browse the repository at this point in the history
The current mission id is set to null in
onIsarStatusUpdate if the robot status is available
before triggering onRobotAvailable, so we don't need
to check if it's null in onRobotAvailable.
  • Loading branch information
oysand committed Nov 27, 2024
1 parent f7e0086 commit ac36b4d
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions backend/api/EventHandlers/MissionEventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,6 @@ private async void OnRobotAvailable(object? sender, RobotAvailableEventArgs e)
return;
}

if (robot.CurrentMissionId != null)
{
var stuckMission = await MissionService.ReadById(robot.CurrentMissionId!, readOnly: true);
if (stuckMission == null)
{
_logger.LogError("MissionRun with ID: {MissionId} was not found in the database", robot.CurrentMissionId);
return;
}
if (stuckMission.Status == MissionStatus.Ongoing || stuckMission.Status == MissionStatus.Paused)
{
_logger.LogError("Ongoing/paused mission with ID: ${MissionId} is not being run in ISAR", robot.CurrentMissionId);
await MissionService.SetMissionRunToFailed(stuckMission.Id, "Mission failed due to issue with ISAR");
}
}

_startMissionSemaphore.WaitOne();
try { await MissionScheduling.StartNextMissionRunIfSystemIsAvailable(robot.Id); }
catch (MissionRunNotFoundException) { return; }
Expand Down

0 comments on commit ac36b4d

Please sign in to comment.