Skip to content

Commit

Permalink
Add new provider
Browse files Browse the repository at this point in the history
  • Loading branch information
oysand committed Jun 24, 2024
1 parent 4053e90 commit 57bbfb8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/api/EventHandlers/MqttEventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ private async void OnIsarStatus(object? sender, MqttReceivedArgs mqttArgs)
if (robot.Status == isarStatus.Status) { return; }

if (await missionRunService.OngoingLocalizationMissionRunExists(robot.Id)) Thread.Sleep(5000); // Give localization mission update time to complete
var preUpdatedRobot = await robotService.ReadByIsarId(isarStatus.IsarId);
var newProvider = GetServiceProvider(); // To ensure that the robot updates the other values correctly, it needs to get a new provider and service
var newRobotService = newProvider.GetRequiredService<IRobotService>();

var preUpdatedRobot = await newRobotService.ReadByIsarId(isarStatus.IsarId);
if (preUpdatedRobot == null)
{
_logger.LogInformation("Received message from unknown ISAR instance {Id} with robot name {Name}", isarStatus.IsarId, isarStatus.RobotName);
Expand Down

0 comments on commit 57bbfb8

Please sign in to comment.