From 75f4d5ef99d61e5e150029815d85fbad05e7d71e Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 18 Oct 2023 23:11:35 +0200 Subject: [PATCH] processing --- modules/robot/robot.go | 10 ++++------ routers/api/v1/control/control.go | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/robot/robot.go b/modules/robot/robot.go index 4ad041a..b05117c 100644 --- a/modules/robot/robot.go +++ b/modules/robot/robot.go @@ -96,8 +96,8 @@ func RobotFreeUpJobHandler() { continue } - logger.AddSystemLog(rslogger.LogTypeError, "Robot %s job with id %s and name %s freed up because it was not correctly finished", robot.Name, robot.CurrentJobId, robot.CurrentJobName) - logger.AddRobotLog(rslogger.LogTypeError, robot.Type, robot.Id, "Job with id %s and name %s freed up because it was not correctly finished", robot.CurrentJobId, robot.CurrentJobName) + logger.AddSystemLog(rslogger.LogTypeError, "Robot %s job with id %s and name %s freed up after %v because it was not correctly finished", robot.Name, robot.CurrentJobId, robot.CurrentJobName, utils.RobotFreeUpJobInterval) + logger.AddRobotLog(rslogger.LogTypeError, robot.Type, robot.Id, "Job with id %s and name %s freed up after %v because it was not correctly finished", robot.CurrentJobId, robot.CurrentJobName, utils.RobotFreeUpJobInterval) FreeUpJob(robot, utils.RobotStatusError) } @@ -156,11 +156,9 @@ func ProcessJobTask(r *structs.Robot, jobId string, jobName string) { CountUpJobsWaiting(r, jobId, jobName) } + // wait for current job to finish for r.CurrentJobId != "" && - r.CurrentJobId != jobId && - r.Status != utils.RobotStatusWaiting && - r.Status != utils.RobotStatusError { - // wait for current job to finish + r.CurrentJobId != jobId { if r.Status == utils.RobotStatusOffline { logger.AddRobotLog(rslogger.LogTypeError, r.Type, r.Id, "Job with id %s and name %s canceled", jobId, jobName) return diff --git a/routers/api/v1/control/control.go b/routers/api/v1/control/control.go index 7638c22..ccd0330 100644 --- a/routers/api/v1/control/control.go +++ b/routers/api/v1/control/control.go @@ -116,6 +116,7 @@ func FinishControlRex(c *fiber.Ctx) error { robot.UpdateRobotCurrentJob(r, "", "") robot.CountDownJobsWaiting(r) + robot.UpdateRobotStatus(r, utils.RobotStatusIdle) logger.AddRobotLog(rslogger.LogTypeInfo, utils.RobotTypeRex, r.Id, "Finish control robot")