feature: Trace log message on ExecRequest for debugging (#375)

This commit is contained in:
James Read 2024-08-06 14:46:49 +01:00 committed by GitHub
parent 6958445f83
commit 8cd5b9fb46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 7 deletions

View File

@ -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)