From 679b0705e89f8290dd3d7d22acbfe03a95aa5e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Chirico=20Indreb=C3=B8?= Date: Thu, 2 Jan 2025 10:25:54 +0100 Subject: [PATCH] Avoid database write conflicts for robots --- backend/api.test/Services/RobotService.cs | 2 +- backend/api/Services/RobotService.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/api.test/Services/RobotService.cs b/backend/api.test/Services/RobotService.cs index 789ba0d6..32025805 100644 --- a/backend/api.test/Services/RobotService.cs +++ b/backend/api.test/Services/RobotService.cs @@ -96,7 +96,7 @@ public async Task Read() ); var installation = await _databaseUtilities.ReadOrNewInstallation(); var robot = await _databaseUtilities.NewRobot(RobotStatus.Available, installation); - var robotById = await robotService.ReadById(robot.Id, readOnly: false); + var robotById = await robotService.ReadById(robot.Id, readOnly: true); Assert.NotNull(robotById); Assert.Equal(robot.Id, robotById.Id); } diff --git a/backend/api/Services/RobotService.cs b/backend/api/Services/RobotService.cs index 50dab6c0..72f82355 100644 --- a/backend/api/Services/RobotService.cs +++ b/backend/api/Services/RobotService.cs @@ -413,7 +413,7 @@ private async Task UpdateRobotProperty( bool isLogLevelDebug = false ) { - var robot = await ReadById(robotId, readOnly: false); + var robot = await ReadById(robotId, readOnly: true); if (robot is null) { string errorMessage = $"Robot with ID {robotId} was not found in the database";