Explorar o código

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

James Read hai 1 ano
pai
achega
8cd5b9fb46
Modificáronse 1 ficheiros con 4 adicións e 7 borrados
  1. 4 7
      internal/executor/executor.go

+ 4 - 7
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)