mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
refine code
This commit is contained in:
parent
c0bb425d8f
commit
2d98d2412a
@ -64,11 +64,9 @@ func (cfgCtlr *configController) dumpPriorityLevels(w http.ResponseWriter, r *ht
|
||||
}
|
||||
tabPrint(tabWriter, rowForHeaders(columnHeaders))
|
||||
endLine(tabWriter)
|
||||
plNames := make([]string, len(cfgCtlr.priorityLevelStates))
|
||||
i := 0
|
||||
plNames := make([]string, 0, len(cfgCtlr.priorityLevelStates))
|
||||
for plName := range cfgCtlr.priorityLevelStates {
|
||||
plNames[i] = plName
|
||||
i++
|
||||
plNames = append(plNames, plName)
|
||||
}
|
||||
sort.Strings(plNames)
|
||||
for i := range plNames {
|
||||
|
@ -181,7 +181,7 @@ func (cfgCtlr *configController) Handle(ctx context.Context, requestDigest Reque
|
||||
metrics.ObserveWaitingDuration(ctx, pl.Name, fs.Name, strconv.FormatBool(req != nil), time.Since(startWaitingTime))
|
||||
}
|
||||
metrics.AddDispatch(ctx, pl.Name, fs.Name)
|
||||
fqs.OnRequestDispatched(ctx, req)
|
||||
fqs.OnRequestDispatched(req)
|
||||
executed = true
|
||||
startExecutionTime := time.Now()
|
||||
defer func() {
|
||||
|
@ -1071,7 +1071,7 @@ func (qs *queueSet) Dump(includeRequestDetails bool) debug.QueueSetDump {
|
||||
return d
|
||||
}
|
||||
|
||||
func OnRequestDispatched(ctx context.Context, r fq.Request) {
|
||||
func OnRequestDispatched(r fq.Request) {
|
||||
req, ok := r.(*request)
|
||||
if !ok {
|
||||
return
|
||||
@ -1079,7 +1079,7 @@ func OnRequestDispatched(ctx context.Context, r fq.Request) {
|
||||
|
||||
qs := req.qs
|
||||
if qs != nil {
|
||||
qs.lockAndSyncTime(ctx)
|
||||
qs.lock.Lock()
|
||||
defer qs.lock.Unlock()
|
||||
qs.totRequestsDispatched++
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user