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