From 8cd5b9fb46c0842d0bec5926c05bb55a0fd4cfaf Mon Sep 17 00:00:00 2001 From: James Read Date: Tue, 6 Aug 2024 14:46:49 +0100 Subject: [PATCH] feature: Trace log message on ExecRequest for debugging (#375) --- internal/executor/executor.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/internal/executor/executor.go b/internal/executor/executor.go index ea038e9..7aeed52 100644 --- a/internal/executor/executor.go +++ b/internal/executor/executor.go @@ -135,11 +135,6 @@ func (e *Executor) AddListener(m listener) { // ExecRequest processes an ExecutionRequest func (e *Executor) ExecRequest(req *ExecutionRequest) (*sync.WaitGroup, string) { req.executor = e - - // req.UUID is now set by the client, so that they can track the request - // from start to finish. This means that a malicious client could send - // duplicate UUIDs (or just random strings), but this is the only way. - req.logEntry = &InternalLogEntry{ DatetimeStarted: time.Now(), ExecutionTrackingID: req.TrackingID, @@ -152,12 +147,14 @@ func (e *Executor) ExecRequest(req *ExecutionRequest) (*sync.WaitGroup, string) ActionIcon: "💩", } - _, foundLog := e.Logs[req.TrackingID] + _, isDuplicate := e.Logs[req.TrackingID] - if foundLog || req.TrackingID == "" { + if isDuplicate || req.TrackingID == "" { req.TrackingID = uuid.NewString() } + log.Tracef("executor.ExecRequest(): %v", req) + e.Logs[req.TrackingID] = req.logEntry wg := new(sync.WaitGroup)