diff --git a/PARR.DAL/Repositories/RobotConfigurationRepository.cs b/PARR.DAL/Repositories/RobotConfigurationRepository.cs index ad3c63f6..efbb22be 100644 --- a/PARR.DAL/Repositories/RobotConfigurationRepository.cs +++ b/PARR.DAL/Repositories/RobotConfigurationRepository.cs @@ -116,12 +116,12 @@ namespace PARR.DAL.Repositories var endDate = DateTimeOffset.UtcNow.Add(-settingsFromDb.RobotWaitTime); // Выполняем атомарный UPDATE напрямую в базе данных - var affectedRows = await EntitySet.Where(t => t.Id == id + var affectedRows = await EntitySet.Where(t => t.Id == id && ( // Задания в статусе ожидание t.RobotStatusCode == (int)RobotStatusEnum.Wait || ( - // Задание в статусе в работе, но они зависли + // Задание в статусе в работе, но они зависли t.RobotStatusCode == (int)RobotStatusEnum.InProgress && t.AttemptsNumber < settingsFromDb.RobotAttemptsNumber && t.LastRobotStatusUpdated < endDate @@ -131,6 +131,7 @@ namespace PARR.DAL.Repositories .ExecuteUpdateAsync(s => s .SetProperty(t => t.RobotStatusCode, (int)RobotStatusEnum.InProgress) .SetProperty(t => t.LastRobotStatusUpdated, DateTimeOffset.UtcNow) + .SetProperty(t => t.AttemptsNumber, t => t.AttemptsNumber + 1) ); return affectedRows > 0; diff --git a/PARR.SnapshotWorker/Dockerfile b/PARR.SnapshotWorker/Dockerfile index 1dba85b6..65553c01 100644 --- a/PARR.SnapshotWorker/Dockerfile +++ b/PARR.SnapshotWorker/Dockerfile @@ -2,13 +2,13 @@ # This stage is used when running from VS in fast mode (Default for Debug configuration) FROM 10.99.253.167:8090/dotnet/runtime:9.0 AS base -#USER $APP_UID WORKDIR /app # This stage is used to build the service project FROM 10.99.253.167:8090/dotnet/sdk:9.0 AS build ARG BUILD_CONFIGURATION=Release +USER root WORKDIR /src COPY ["NuGet.config", "."] COPY ["PARR.SnapshotWorker/PARR.SnapshotWorker.csproj", "PARR.SnapshotWorker/"]