chore: coderabbit suggestions
This commit is contained in:
parent
0e8f7c7be3
commit
8622b5b06c
|
|
@ -587,8 +587,6 @@ func (e *Executor) initializeExecRequest(req *ExecutionRequest) {
|
|||
ActionIcon: "💩",
|
||||
Username: req.AuthenticatedUser.Username,
|
||||
}
|
||||
|
||||
req.logEntry.ExecutionTrackingID = req.TrackingID
|
||||
}
|
||||
|
||||
func bindingIDForTrace(req *ExecutionRequest) string {
|
||||
|
|
@ -665,8 +663,8 @@ func getConcurrentCount(req *ExecutionRequest) int {
|
|||
req.executor.logmutex.RLock()
|
||||
logs := req.executor.LogsByBindingId[req.Binding.ID]
|
||||
|
||||
for _, log := range logs {
|
||||
if !log.ExecutionFinished && !log.Queued {
|
||||
for _, logEntry := range logs {
|
||||
if !logEntry.ExecutionFinished && !logEntry.Queued {
|
||||
concurrentCount += 1
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,6 +144,8 @@ func firstFullGroupNameLocked(e *Executor, req *ExecutionRequest) string {
|
|||
}
|
||||
|
||||
func (e *Executor) queueRequest(req *ExecutionRequest, wg *sync.WaitGroup) {
|
||||
e.groupQueueMu.Lock()
|
||||
|
||||
var groupName string
|
||||
|
||||
req.mutateLogEntry(func(entry *InternalLogEntry) {
|
||||
|
|
@ -153,14 +155,15 @@ func (e *Executor) queueRequest(req *ExecutionRequest, wg *sync.WaitGroup) {
|
|||
entry.Output = fmt.Sprintf("Queued waiting for action group %q", groupName)
|
||||
})
|
||||
|
||||
e.groupQueue = append(e.groupQueue, &queuedExecution{req: req, wg: wg})
|
||||
e.groupQueueMu.Unlock()
|
||||
|
||||
e.drainGroupQueue()
|
||||
|
||||
log.WithFields(log.Fields{
|
||||
"actionTitle": req.logEntry.ActionTitle,
|
||||
"groupName": groupName,
|
||||
}).Infof("Action queued due to action group concurrency limit")
|
||||
|
||||
e.groupQueueMu.Lock()
|
||||
e.groupQueue = append(e.groupQueue, &queuedExecution{req: req, wg: wg})
|
||||
e.groupQueueMu.Unlock()
|
||||
}
|
||||
|
||||
func (e *Executor) drainGroupQueue() {
|
||||
|
|
@ -178,13 +181,14 @@ func (e *Executor) drainGroupQueue() {
|
|||
}
|
||||
|
||||
e.groupQueue = e.groupQueue[1:]
|
||||
e.groupQueueMu.Unlock()
|
||||
|
||||
next.req.mutateLogEntry(func(entry *InternalLogEntry) {
|
||||
entry.Queued = false
|
||||
entry.QueuedForGroup = ""
|
||||
})
|
||||
|
||||
e.groupQueueMu.Unlock()
|
||||
|
||||
go e.runDequeuedExecution(next)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue