Manager: only log task status change if there is an actual change

Don't log "changes" from, say, `active` -> `active`.
This commit is contained in:
Sybren A. Stüvel 2022-07-19 17:47:43 +02:00
parent ac3236786b
commit d929885b06

View File

@ -80,10 +80,12 @@ func (sm *StateMachine) taskStatusChangeOnly(
return fmt.Errorf("saving task to database: %w", err) return fmt.Errorf("saving task to database: %w", err)
} }
// logStorage already logs any error, and an error here shouldn't block the if oldTaskStatus != newTaskStatus {
// rest of the function. // logStorage already logs any error, and an error here shouldn't block the
_ = sm.logStorage.WriteTimestamped(logger, job.UUID, task.UUID, // rest of the function.
fmt.Sprintf("task changed status %s -> %s", oldTaskStatus, newTaskStatus)) _ = sm.logStorage.WriteTimestamped(logger, job.UUID, task.UUID,
fmt.Sprintf("task changed status %s -> %s", oldTaskStatus, newTaskStatus))
}
// Broadcast this change to the SocketIO clients. // Broadcast this change to the SocketIO clients.
taskUpdate := webupdates.NewTaskUpdate(task) taskUpdate := webupdates.NewTaskUpdate(task)